![]() |
DUNE: Uniform Navigational Environment
2.3.0
|
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 (Address add, uint16_t port) |
void | listen (int backlog) |
TCPSocket * | accept (Address *a=0, uint16_t *port=0) |
int | write (const char *buffer, int len) |
int | read (char *buffer, int len) |
bool | writeFile (const char *filename, int64_t off_end, int64_t off_beg=-1) |
void | addToPoll (System::IOMultiplexing &p) |
void | delFromPoll (System::IOMultiplexing &p) |
bool | wasTriggered (System::IOMultiplexing &p) |
void | setKeepAlive (bool enabled) |
void | setNoDelay (bool enabled) |
void | setReceiveTimeout (double timeout) |
void | setSendTimeout (double timeout) |
Address | getBoundAddress (void) |
uint16_t | getBoundPort (void) |
DUNE::Network::TCPSocket::TCPSocket | ( | bool | create = true | ) |
Create an unbound TCP socket.
Referenced by accept().
DUNE::Network::TCPSocket::~TCPSocket | ( | void | ) |
Destroy an TCP socket.
References DUNE::Utils::ByteCopy::fromBE(), and TCPSocket().
Referenced by DUNE::Network::HTTPServer::poll().
void DUNE::Network::TCPSocket::addToPoll | ( | System::IOMultiplexing & | p | ) |
References DUNE::System::IOMultiplexing::add().
Referenced by DUNE::Network::HTTPServer::HTTPServer(), and Transports::Evologics::Listener::Listener().
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().
Referenced by DUNE::Network::HTTPServer::HTTPServer().
void DUNE::Network::TCPSocket::connect | ( | Address | add, |
uint16_t | port | ||
) |
References DUNE::Utils::ByteCopy::toBE(), and DUNE::Network::Address::toInteger().
void DUNE::Network::TCPSocket::delFromPoll | ( | System::IOMultiplexing & | p | ) |
References DUNE::System::IOMultiplexing::del().
Address DUNE::Network::TCPSocket::getBoundAddress | ( | void | ) |
References DUNE::Network::Address, and DUNE::Utils::ByteCopy::fromBE().
uint16_t DUNE::Network::TCPSocket::getBoundPort | ( | void | ) |
References DUNE::Utils::ByteCopy::fromBE().
void DUNE::Network::TCPSocket::listen | ( | int | backlog | ) |
Referenced by DUNE::Network::HTTPServer::HTTPServer().
int DUNE::Network::TCPSocket::read | ( | char * | buffer, |
int | len | ||
) |
void DUNE::Network::TCPSocket::setKeepAlive | ( | bool | enabled | ) |
Enable/disable keep-alive messages.
When enabled connections are kept active by periodically transmitting messages.
[in] | enabled | true to enable this feature, false to disable. |
void DUNE::Network::TCPSocket::setNoDelay | ( | bool | enabled | ) |
Disable/enable the Nagle algorithm.
[in] | enabled | true 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.
[in] | timeout | timeout 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.
[in] | timeout | timeout value in second. |
Referenced by Transports::FTP::Session::Session().
bool DUNE::Network::TCPSocket::wasTriggered | ( | System::IOMultiplexing & | p | ) |
References DUNE::System::IOMultiplexing::wasTriggered().
Referenced by DUNE::Network::HTTPServer::poll().
int DUNE::Network::TCPSocket::write | ( | const char * | buffer, |
int | len | ||
) |
Referenced by DUNE::Network::HTTPRequestHandler::sendData(), DUNE::Network::HTTPRequestHandler::sendHeader(), DUNE::Network::HTTPRequestHandler::sendResponse100(), DUNE::Network::HTTPRequestHandler::sendResponse200(), DUNE::Network::HTTPRequestHandler::sendResponse201(), DUNE::Network::HTTPRequestHandler::sendResponse403(), DUNE::Network::HTTPRequestHandler::sendResponse404(), DUNE::Network::HTTPRequestHandler::sendResponse416(), DUNE::Network::HTTPRequestHandler::sendResponse500(), DUNE::Network::HTTPRequestHandler::sendResponse503(), writeFile(), and Transports::Evologics::Listener::writeString().
bool DUNE::Network::TCPSocket::writeFile | ( | const char * | filename, |
int64_t | off_end, | ||
int64_t | off_beg = -1 |
||
) |
References write().
Referenced by DUNE::Network::HTTPRequestHandler::sendFile().