Get the foreign port. Call connect() before calling recv()
Definition at line 228 of file PracticalSocket.cpp. References Socket::sockDesc. 00228 { 00229 sockaddr_in addr; 00230 unsigned int addr_len = sizeof(addr); 00231 00232 if (getpeername(sockDesc, (sockaddr *) &addr, (socklen_t *) &addr_len) < 0) { 00233 throw SocketException("Fetch of foreign port failed (getpeername())", true); 00234 } 00235 return ntohs(addr.sin_port); 00236 }
|