oasys::TCPServer Class Reference

#include <TCPServer.h>

Inheritance diagram for oasys::TCPServer:

oasys::IPSocket oasys::Logger oasys::IOHandlerBase oasys::TCPServerThread dtn::APIServer dtn::TCPConvergenceLayer::Listener dtntunnel::TCPTunnel::Listener oasys::SMTPServer

List of all members.


Detailed Description

Wrapper class for a tcp server socket.

Definition at line 31 of file TCPServer.h.


Public Member Functions

 TCPServer (const char *logbase="/oasys/tcpserver")
int timeout_accept (int *fd, in_addr_t *addr, u_int16_t *port, int timeout_ms)
int listen ()
 System call wrapper.
int accept (int *fd, in_addr_t *addr, u_int16_t *port)
 System call wrapper.

Constructor & Destructor Documentation

oasys::TCPServer::TCPServer ( const char *  logbase = "/oasys/tcpserver"  ) 

Definition at line 31 of file TCPServer.cc.

References oasys::IPSocket::params_, and oasys::IPSocket::ip_socket_params::reuseaddr_.


Member Function Documentation

int oasys::TCPServer::listen (  ) 

System call wrapper.

Definition at line 38 of file TCPServer.cc.

References ASSERT, errno, oasys::IPSocket::fd_, oasys::IPSocket::LISTENING, oasys::LOG_DEBUG, oasys::LOG_ERR, oasys::Logger::logf(), and oasys::IPSocket::set_state().

Referenced by oasys::TCPServerThread::bind_listen_start(), and dtn::TCPConvergenceLayer::interface_up().

int oasys::TCPServer::accept ( int *  fd,
in_addr_t *  addr,
u_int16_t *  port 
)

System call wrapper.

Definition at line 53 of file TCPServer.cc.

References oasys::IO::ACCEPT, errno, oasys::IPSocket::fd_, oasys::IPSocket::LISTENING, oasys::LOG_ERR, oasys::Logger::logf(), oasys::IOHandlerBase::monitor(), oasys::IPSocket::state_, and oasys::IPSocket::statetoa().

Referenced by oasys::TCPServerThread::run(), and timeout_accept().

int oasys::TCPServer::timeout_accept ( int *  fd,
in_addr_t *  addr,
u_int16_t *  port,
int  timeout_ms 
)

Try to accept a new connection, but don't block for more than the timeout milliseconds.

Returns:
0 on timeout, 1 on success, -1 on error

Definition at line 78 of file TCPServer.cc.

References oasys::IO::ACCEPT, accept(), ASSERT, oasys::IOERROR, oasys::IOHandlerBase::monitor(), and oasys::IPSocket::poll_sockfd().

Referenced by oasys::TCPServerThread::run().


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:43:52 2007 for DTN Reference Implementation by  doxygen 1.5.3