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

unsigned short CommunicatingSocket::getForeignPort (  )  throw (SocketException)

Get the foreign port.

Call connect() before calling recv()

Returns:
foreign port
Exceptions:
SocketException thrown if unable to fetch foreign port

Definition at line 228 of file PracticalSocket.cpp.

References Socket::sockDesc.

00228                                                                           {
00229   sockaddr_in addr;
00230   unsigned int addr_len = sizeof(addr);
00231 
00232   if (getpeername(sockDesc, (sockaddr *) &addr, (socklen_t *) &addr_len) < 0) {
00233     throw SocketException("Fetch of foreign port failed (getpeername())", true);
00234   }
00235   return ntohs(addr.sin_port);
00236 }


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