if (WSAStartup(0x0101, &wsaData))
{
printf("WSAStartup failed %s\n", WSAGetLastError());
return;
}
pHostEnt = gethostbyname( "www.sina.com.cn");
while ( pHostEnt->h_addr_list[nAdapter] )
{
// pHostEnt->h_addr_list[nAdapter] is the current address in host
// order.
// Copy the address information from the pHostEnt to a sockaddr_in
// structure.
memcpy ( &sAddr.sin_addr.s_addr, pHostEnt->h_addr_list[nAdapter],
pHostEnt->h_length);
// Output the machines IP Address.
printf("Name: %s\nAddress: %s\n", pHostEnt->h_name,
inet_ntoa(sAddr.sin_addr));