Closed lianhub closed 6 years ago
Unfortunately that's no bug. sin_port is in "network byteorder/big endian" so you would have to convert it back into host byteorder with ntohs() and will see it is correct. You could use Wireshark[1] to see the packet on wire (in network byte order, but wireshark will decode correctly).
OK, I see the logic! Thanks Pbruenn, so this issue can be closed now!
I think I may find a bug:
I modified Sockets.cpp to print the port number:
printf("The IP address is: %s Port: %d\n", inet_ntoa(m_SockAddress.sin_addr), m_SockAddress.sin_port);
if (::connect(m_Socket, reinterpret_cast<const sockaddr*>(&m_SockAddress), sizeof(m_SockAddress))) { LOG_ERROR("Connect TCP socket failed with: " << WSAGetLastError()); return 0; } ... }
then I got:
Shouldn't the port be 48898? Anybody can confirm my conclusion? or maybe I am wrong?
Thanks, Jerry