| 124 | } |
| 125 | |
| 126 | unsigned short Socket::getLocalPort() throw(SocketException) { |
| 127 | sockaddr_in addr; |
| 128 | unsigned int addr_len = sizeof(addr); |
| 129 | |
| 130 | if (getsockname(sockDesc, (sockaddr *) &addr, (socklen_t *) &addr_len) < 0) { |
| 131 | throw SocketException("Fetch of local port failed (getsockname())", true); |
| 132 | } |
| 133 | return ntohs(addr.sin_port); |
| 134 | } |
| 135 | |
| 136 | void Socket::setLocalPort(unsigned short localPort) throw(SocketException) { |
| 137 | // Bind the socket to its port |
nothing calls this directly
no test coverage detected