Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

void Socket::setLocalPort ( unsigned short  localPort  )  throw (SocketException)

Set the local port to the specified port and the local address to any interface.

Parameters:
localPort local port
Exceptions:
SocketException thrown if setting local port fails

Definition at line 133 of file PracticalSocket.cpp.

00133                                                                          {
00134   // Bind the socket to its port
00135   sockaddr_in localAddr;
00136   memset(&localAddr, 0, sizeof(localAddr));
00137   localAddr.sin_family = AF_INET;
00138   localAddr.sin_addr.s_addr = htonl(INADDR_ANY);
00139   localAddr.sin_port = htons(localPort);
00140 
00141   if (bind(sockDesc, (sockaddr *) &localAddr, sizeof(sockaddr_in)) < 0) {
00142     throw SocketException("Set of local port failed (bind())", true);
00143   }
00144 }


Generated on Thu Jan 13 09:13:08 2011 for ImpalaSrc by  doxygen 1.5.1