Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

static void fillAddr ( const string &  address,
unsigned short  port,
sockaddr_in &  addr 
) [static]

Definition at line 62 of file PracticalSocket.cpp.

Referenced by CommunicatingSocket::connect(), UDPSocket::sendTo(), and Socket::setLocalAddressAndPort().

00063                                         {
00064   memset(&addr, 0, sizeof(addr));  // Zero out address structure
00065   addr.sin_family = AF_INET;       // Internet address
00066 
00067   hostent *host;  // Resolve name
00068   if ((host = gethostbyname(address.c_str())) == NULL) {
00069     // strerror() will not work for gethostbyname() and hstrerror() 
00070     // is supposedly obsolete
00071     throw SocketException("Failed to resolve name (gethostbyname())");
00072   }
00073   addr.sin_addr.s_addr = *((unsigned long *) host->h_addr_list[0]);
00074 
00075   addr.sin_port = htons(port);     // Assign port in network byte order
00076 }


Generated on Fri Mar 19 09:40:40 2010 for ImpalaSrc by  doxygen 1.5.1