Get the local port.
Definition at line 123 of file PracticalSocket.cpp. References sockDesc. 00123 { 00124 sockaddr_in addr; 00125 unsigned int addr_len = sizeof(addr); 00126 00127 if (getsockname(sockDesc, (sockaddr *) &addr, (socklen_t *) &addr_len) < 0) { 00128 throw SocketException("Fetch of local port failed (getsockname())", true); 00129 } 00130 return ntohs(addr.sin_port); 00131 }
|