October 27, 2006

Socket Server code - addressing bug fix

There's a bug in one of the constructors for CSocket::InternetAddress which means that changing the example servers to use a specific network adapter's address, rather than INADDR_ANY will generate an exception from the call to bind which says that the address is invalid.

The code currently reads like this:

CSocket::InternetAddress::InternetAddress(
   const unsigned long address,
   const unsigned short port)
{
   sin_family = AF_INET;
   sin_port = htons(port);
   sin_addr.s_addr = htonl(address);
}

and it should read like this:

CSocket::InternetAddress::InternetAddress(
   const unsigned long address,
   const unsigned short port)
{
   sin_family = AF_INET;
   sin_port = htons(port);
   sin_addr.s_addr = address;
}

This bug only affects the code that's freely available on my blog (here) and doesn't affect the licensed version.


Share this entry: Email it! | bookmark it! | digg it! | reddit!

Posted by Len at October 27, 2006 12:40 PM | Comments (0) | Categories : Socket Servers
Comments
Post a comment









Remember personal info?




Enter this code in the box below to prove that you're not some kind of automated spam robot...