| 134 | } |
| 135 | |
| 136 | void Socket::setLocalPort(unsigned short localPort) throw(SocketException) { |
| 137 | // Bind the socket to its port |
| 138 | sockaddr_in localAddr; |
| 139 | memset(&localAddr, 0, sizeof(localAddr)); |
| 140 | localAddr.sin_family = AF_INET; |
| 141 | localAddr.sin_addr.s_addr = htonl(INADDR_ANY); |
| 142 | localAddr.sin_port = htons(localPort); |
| 143 | |
| 144 | if (bind(sockDesc, (sockaddr *) &localAddr, sizeof(sockaddr_in)) < 0) { |
| 145 | throw SocketException("Set of local port failed (bind())", true); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | void Socket::setLocalAddressAndPort(const string &localAddress, |
| 150 | unsigned short localPort) throw(SocketException) { |
nothing calls this directly
no test coverage detected