HI,
I have been trying to get sockets to work but for some reason it does not work:
Code:
const char *ip_address = "127.0.0.1";
client=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(client==INVALID_SOCKET) {
return -1;
}
hostent *server_ip_address = gethostbyaddr(ip_address,sizeof(ip_address),AF_INET);
gethostbyaddr returns null for some reason although I have a server program running and listening and I am sure the server program works because I tested it with telnet. I am trying to use part of the example on this website:
http://www.codeproject.com/internet/winsockintro02.asp
Hopefully somebody can help me out. Thanks
Amish