|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Socket Programming, we must employ to gethostbyname ()?
SOCKET Can not call this function normally.
Calling his return is a hostent structure, which is useful if a h_addr, we can give him to pay for the value of the country, can not be deployed? Do they normally do? By Frank. |
Socket Programming, we must employ to gethostbyname ()?
Of course, you do not have this function, but under normal circumstances would not become more complicated, because you have to you from the socket definition Assignment. |
Socket Programming, we must employ to gethostbyname ()?
PHost = gethostbyname (sHost);
If (pHost ====== NULL)
{
Addr = inet_addr (sHost);
If (addr ====== NULL)
{
Return 1;
}
}
Else
Addr = * ((unsigned long *) pHost->;h_addr);
SHost or which hosts (defined in /etc/hosts inside), or IP address |
| |