Sebastiani
Programmer
Hi, all. Now that I have the client functioning, I would like to complete the server. The problem I am having now is with bind()ing the listening socket. Here is the code I am using:
The two addresses I tried as the second parameter were the manifest constants INADDR_ANY and INADDR_LOOPBACK (as well as htonl(INADDR_ANY) and htonl(INADDR_LOOPBACK) ).
Any ideas?
Code:
bool bind(SOCKET sock, unsigned long address, unsigned short port = 80)
{
sockaddr_in local;
memset(&local, 0, sizeof(sockaddr_in));
local.sin_family = AF_INET;
local.sin_port = port;//...also tried htons(port)...
local.sin_addr.S_un.S_addr = address;
return ::bind(sock, (sockaddr*)&remote, sizeof(remote)) != SOCKET_ERROR;
}
The two addresses I tried as the second parameter were the manifest constants INADDR_ANY and INADDR_LOOPBACK (as well as htonl(INADDR_ANY) and htonl(INADDR_LOOPBACK) ).
Any ideas?