DUNE: Uniform Navigational Environment  2.4.2
DUNE::Network::TCPSocket Class Reference

Detailed Description

TCP Socket.

Public Member Functions

 TCPSocket (bool create=true)
 
 ~TCPSocket (void)
 
void bind (uint16_t port=0, Address add=Address::Any, bool reuse=true)
 
void connect (const Address &add, uint16_t port)
 
void listen (int backlog)
 
TCPSocketaccept (Address *a=0, uint16_t *port=0)
 
bool writeFile (const char *filename, int64_t off_end, int64_t off_beg=-1)
 
void setKeepAlive (bool enabled)
 
void setNoDelay (bool enabled)
 
void setReceiveTimeout (double timeout)
 
void setSendTimeout (double timeout)
 
Address getBoundAddress (void)
 
uint16_t getBoundPort (void)
 
- Public Member Functions inherited from DUNE::IO::Handle
virtual ~Handle (void)
 
size_t write (const uint8_t *data, size_t length)
 
size_t write (const char *data, size_t length)
 
size_t writeString (const char *cstr)
 
size_t read (uint8_t *data, size_t length)
 
size_t read (char *data, size_t length)
 
size_t readString (char *bfr, size_t length)
 
void flush (void)
 
void flushInput (void)
 
void flushOutput (void)
 
NativeHandle getNative (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from DUNE::IO::Handle
virtual void doFlushOutput (void)
 
virtual void doFlush (void)
 

Constructor & Destructor Documentation

DUNE::Network::TCPSocket::TCPSocket ( bool  create = true)

Create an unbound TCP socket.

Referenced by accept().

DUNE::Network::TCPSocket::~TCPSocket ( void  )

Destroy an TCP socket.

Member Function Documentation

TCPSocket * DUNE::Network::TCPSocket::accept ( Address a = 0,
uint16_t *  port = 0 
)
void DUNE::Network::TCPSocket::bind ( uint16_t  port = 0,
Address  add = Address::Any,
bool  reuse = true 
)

Assign a name to a socket.

References DUNE::Utils::ByteCopy::toBE(), and DUNE::Network::Address::toInteger().

void DUNE::Network::TCPSocket::connect ( const Address add,
uint16_t  port 
)
Address DUNE::Network::TCPSocket::getBoundAddress ( void  )
uint16_t DUNE::Network::TCPSocket::getBoundPort ( void  )
void DUNE::Network::TCPSocket::listen ( int  backlog)
void DUNE::Network::TCPSocket::setKeepAlive ( bool  enabled)

Enable/disable keep-alive messages.

When enabled connections are kept active by periodically transmitting messages.

Parameters
[in]enabledtrue to enable this feature, false to disable.
void DUNE::Network::TCPSocket::setNoDelay ( bool  enabled)

Disable/enable the Nagle algorithm.

Parameters
[in]enabledtrue to disable Nagle algorithm, false to enable.

Referenced by Transports::FTP::Session::Session().

void DUNE::Network::TCPSocket::setReceiveTimeout ( double  timeout)

Set the timeout value that specifies the maximum amount of time an input function waits until it completes.

Parameters
[in]timeouttimeout value in second.

Referenced by Transports::FTP::Session::Session().

void DUNE::Network::TCPSocket::setSendTimeout ( double  timeout)

Set the timeout value specifying the amount of time that an output function blocks because flow control prevents data from being sent.

Parameters
[in]timeouttimeout value in second.

Referenced by Transports::FTP::Session::Session().

bool DUNE::Network::TCPSocket::writeFile ( const char *  filename,
int64_t  off_end,
int64_t  off_beg = -1 
)
Collaboration diagram for DUNE::Network::TCPSocket:
Collaboration graph