MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / setLocalPort

Method setLocalPort

tools/streamer_recorder/PracticalSocket.cpp:136–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void 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
149void Socket::setLocalAddressAndPort(const string &localAddress,
150 unsigned short localPort) throw(SocketException) {

Callers

nothing calls this directly

Calls 1

SocketExceptionClass · 0.85

Tested by

no test coverage detected