• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

sockets help

Moohooya

Senior member
I there a detailed socket FAQ/reference/guide available on-line as I need some general socket info.

But my specific question is as follows. I have a host name, which I can get an ip address for. When however I call gethostbyaddr passing the correct inetaddress I get back WSANO_DATA. If however I call gethostbyname I get the HOSTENT structure returned.

What gives? Shouldn't both calls be looking up the same record on the name server, but just using different indexes, or are these two fundamentally different functions? I've also not found any decent description of the error WSANO_DATA, but I guess it means the name server has no record for the ip address.

Very confussed,

Moohoo
 
My only thought would be, if you are on a Intel machine, you need to do a host to network long (I think) htnl or something on the number you use for the IP lookup. That is, provided, you didn't already get that number from the network.
 
Thanks michaelh20,

I was correctly doing the htonl but never knew about the google group search. Thanks fot the link, I'll see what they say.
 
Ah got it, thanks. I was passing a pointer to the sockaddr. sa_data structure in which the first two bytes are the port number and not the IP address.

Any one know of any good socket references out there? Winsock & Berkely preferably, but I'd settle for just one.

Thanks
 
Back
Top