diff options
Diffstat (limited to 'src/stable/tcpserversocket.h')
| -rw-r--r-- | src/stable/tcpserversocket.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/stable/tcpserversocket.h b/src/stable/tcpserversocket.h index 9776668..fd1d547 100644 --- a/src/stable/tcpserversocket.h +++ b/src/stable/tcpserversocket.h | |||
| @@ -20,46 +20,46 @@ | |||
| 20 | 20 | ||
| 21 | namespace Bu | 21 | namespace Bu |
| 22 | { | 22 | { |
| 23 | subExceptionDecl( TcpServerSocketException ); | 23 | subExceptionDecl( TcpServerSocketException ); |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * A single tcp/ip server socket. When created the server socket will bind | 26 | * A single tcp/ip server socket. When created the server socket will bind |
| 27 | * to the specified interface and port, and immediately begin listening for | 27 | * to the specified interface and port, and immediately begin listening for |
| 28 | * connections. When connections come in they are pooled by the networking | 28 | * connections. When connections come in they are pooled by the networking |
| 29 | * drivers in the kernel until they are accepted, this means that failure | 29 | * drivers in the kernel until they are accepted, this means that failure |
| 30 | * to keep space in the connection pool will result in connection refusals. | 30 | * to keep space in the connection pool will result in connection refusals. |
| 31 | * | 31 | * |
| 32 | * Although the accept function returns an integral file descriptor, it is | 32 | * Although the accept function returns an integral file descriptor, it is |
| 33 | * designed to be used with the Socket class. | 33 | * designed to be used with the Socket class. |
| 34 | * | 34 | * |
| 35 | *@ingroup Serving | 35 | *@ingroup Serving |
| 36 | */ | 36 | */ |
| 37 | class TcpServerSocket | 37 | class TcpServerSocket |
| 38 | { | 38 | { |
| 39 | public: | 39 | public: |
| 40 | #ifdef WIN32 | 40 | #ifdef WIN32 |
| 41 | typedef unsigned int socket_t; | 41 | typedef unsigned int socket_t; |
| 42 | #else | 42 | #else |
| 43 | typedef int socket_t; | 43 | typedef int socket_t; |
| 44 | #endif | 44 | #endif |
| 45 | TcpServerSocket( int nPort, int nPoolSize=40 ); | 45 | TcpServerSocket( int nPort, int nPoolSize=40 ); |
| 46 | TcpServerSocket( const String &sAddr, int nPort, int nPoolSize=40 ); | 46 | TcpServerSocket( const String &sAddr, int nPort, int nPoolSize=40 ); |
| 47 | TcpServerSocket( socket_t nSocket, bool bInit, int nPoolSize=40 ); | 47 | TcpServerSocket( socket_t nSocket, bool bInit, int nPoolSize=40 ); |
| 48 | TcpServerSocket( const TcpServerSocket &rSrc ); | 48 | TcpServerSocket( const TcpServerSocket &rSrc ); |
| 49 | virtual ~TcpServerSocket(); | 49 | virtual ~TcpServerSocket(); |
| 50 | 50 | ||
| 51 | int accept( int nTimeoutSec=0, int nTimeoutUSec=0 ); | 51 | int accept( int nTimeoutSec=0, int nTimeoutUSec=0 ); |
| 52 | int getSocket(); | 52 | int getSocket(); |
| 53 | int getPort(); | 53 | int getPort(); |
| 54 | 54 | ||
| 55 | private: | 55 | private: |
| 56 | void startServer( struct sockaddr_in &name, int nPoolSize ); | 56 | void startServer( struct sockaddr_in &name, int nPoolSize ); |
| 57 | void initServer( struct sockaddr_in &name, int nPoolSize ); | 57 | void initServer( struct sockaddr_in &name, int nPoolSize ); |
| 58 | 58 | ||
| 59 | fd_set fdActive; | 59 | fd_set fdActive; |
| 60 | socket_t nServer; | 60 | socket_t nServer; |
| 61 | int nPort; | 61 | int nPort; |
| 62 | }; | 62 | }; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #endif | 65 | #endif |
