Get the foreign address. Call connect() before calling recv()
Definition at line 217 of file PracticalSocket.cpp. References Socket::sockDesc. 00218 { 00219 sockaddr_in addr; 00220 unsigned int addr_len = sizeof(addr); 00221 00222 if (getpeername(sockDesc, (sockaddr *) &addr,(socklen_t *) &addr_len) < 0) { 00223 throw SocketException("Fetch of foreign address failed (getpeername())", true); 00224 } 00225 return inet_ntoa(addr.sin_addr); 00226 }
|