Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

TcpServerSocket Class Reference

#include <TcpServerSocket.hpp>

Inheritance diagram for TcpServerSocket::

ServerSocket List of all members.

Public Methods

 TcpServerSocket (int port=0, int backlog=4) throw (int)
 TcpServerSocket (TcpServerSocket &original) throw (int)
 TcpServerSocket (InetAddress &address, int port=0, int backlog=4) throw (int)
InetAddress getInetAddress ()
int getLocalPort ()
int setSoTimeout (int timeout)
int getSoTimeout ()

Protected Attributes

int localPort

Constructor & Destructor Documentation

TcpServerSocket::TcpServerSocket int    port = 0,
int    backlog = 4
throw (int)
 

Definition at line 15 of file TcpServerSocket.cpp.

00016   : ServerSocket((struct sockaddr *)NULL, PF_INET, SOCK_STREAM, 0)
00017 {
00018    struct sockaddr_in *s_in;
00019    lsa= &local_sa;
00020    s_in = (struct sockaddr_in *) &local_sa;
00021    localPort = port;
00022    s_in->sin_family = AF_INET;
00023    s_in->sin_port = htons(port);
00024    s_in->sin_addr.s_addr = htonl(INADDR_ANY);
00025    memset(&(s_in->sin_zero), '\0', 8);
00026    sleep(2);
00027    bind();
00028    ::listen(sck, backlog);
00029 }

TcpServerSocket::TcpServerSocket TcpServerSocket &    original throw (int)
 

Definition at line 31 of file TcpServerSocket.cpp.

00032   : ServerSocket((struct sockaddr *)NULL, PF_INET, SOCK_STREAM, 0)
00033 {
00034   
00035 }

TcpServerSocket::TcpServerSocket InetAddress   address,
int    port = 0,
int    backlog = 4
throw (int)
 

Definition at line 37 of file TcpServerSocket.cpp.

00038   : ServerSocket((struct sockaddr *)NULL, PF_INET, SOCK_STREAM, 0)
00039 {
00040   struct sockaddr_in *s_in = (struct sockaddr_in *)lsa;
00041   localPort = port;
00042   s_in->sin_family = AF_INET;
00043   s_in->sin_port = htons(localPort);
00044   s_in->sin_addr.s_addr = address.getAddress2();
00045   memset(&(s_in->sin_zero), '\0', 8);
00046   bind();
00047   ::listen(sck, backlog);
00048 }


Member Function Documentation

InetAddress TcpServerSocket::getInetAddress  
 

Definition at line 54 of file TcpServerSocket.cpp.

00055 {  
00056   InetAddress I(inet_ntoa(((struct sockaddr_in*)lsa)->sin_addr));
00057   return I;
00058 }

__inline int TcpServerSocket::getLocalPort  
 

Definition at line 60 of file TcpServerSocket.cpp.

00061 {
00062   return localPort;
00063 }

int TcpServerSocket::getSoTimeout  
 

Definition at line 79 of file TcpServerSocket.cpp.

00080 {
00081    return -1;
00082 }

int TcpServerSocket::setSoTimeout int    timeout
 

Definition at line 65 of file TcpServerSocket.cpp.

00066 {
00067 #if 0
00068   if(setSockOpt(SOL_ServerSocket,SO_TIMEOUT,(void *)&timeout,sizeof(int)) != 0)
00069      return -1;
00070 //     perror("TcpServerSocket::setSoTimeout() FAIL");
00071   
00072   return 0;
00073 #else
00074    errno = EBADF;
00075    return -1;
00076 #endif
00077 }


Member Data Documentation

int TcpServerSocket::localPort [protected]
 

Definition at line 44 of file TcpServerSocket.hpp.


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:49:55 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001