#include <mrpt/utils/CServerTCPSocket.h>
Public Member Functions | |
CServerTCPSocket (unsigned short listenPort, const std::string &IPaddress=std::string("127.0.0.1"), int maxConnectionsWaiting=50, bool verbose=false) | |
Constructor that creates the socket, performs binding, and start listening mode. | |
~CServerTCPSocket () | |
Destructor. | |
bool | isListening () |
Returns true if the socket was successfully open and it's bound to the desired port. | |
CClientTCPSocket * | accept (int timeout_ms=-1) |
Waits for an incoming connection (indefinitely, or with a given timeout) The returned object represents the new connection, and MUST BE deleted by the user when no longer needed. | |
Private Member Functions | |
std::string | getLastErrorStr () |
Returns a description of the last error. | |
void | setupSocket (unsigned short listenPort, const std::string &IPaddress, int maxConnectionsWaiting) |
Common code called from the platform-dependant constructor. | |
Private Attributes | |
bool | m_verbose |
Unless otherwise noticed, operations are blocking.
Definition at line 46 of file CServerTCPSocket.h.
mrpt::utils::CServerTCPSocket::CServerTCPSocket | ( | unsigned short | listenPort, | |
const std::string & | IPaddress = std::string("127.0.0.1") , |
|||
int | maxConnectionsWaiting = 50 , |
|||
bool | verbose = false | |||
) |
Constructor that creates the socket, performs binding, and start listening mode.
listenPort | The port to bound to. | |
IPaddress | The interface to bound the socket to. By default 127.0.0.1 implies listening at all network interfaces. | |
maxConnectionsWaiting | Maximum number of incoming connections waiting for "accept" before new ones are rejected. | |
verbose | Whether to dump state information to the output defined in the utils::CDebugOutputCapable interface. You can check if the socket has been created OK with "isListening". |
std::exception | If there is any error creating the socket, with a textual description of the error. |
mrpt::utils::CServerTCPSocket::~CServerTCPSocket | ( | ) |
Destructor.
CClientTCPSocket* mrpt::utils::CServerTCPSocket::accept | ( | int | timeout_ms = -1 |
) |
Waits for an incoming connection (indefinitely, or with a given timeout) The returned object represents the new connection, and MUST BE deleted by the user when no longer needed.
timeout_ms | The timeout for the waiting, in milliseconds. Set this to "-1" to disable timeout (i.e. timeout=infinite) |
std::string mrpt::utils::CServerTCPSocket::getLastErrorStr | ( | ) | [private] |
Returns a description of the last error.
bool mrpt::utils::CServerTCPSocket::isListening | ( | ) |
Returns true if the socket was successfully open and it's bound to the desired port.
void mrpt::utils::CServerTCPSocket::setupSocket | ( | unsigned short | listenPort, | |
const std::string & | IPaddress, | |||
int | maxConnectionsWaiting | |||
) | [private] |
Common code called from the platform-dependant constructor.
bool mrpt::utils::CServerTCPSocket::m_verbose [private] |
Definition at line 65 of file CServerTCPSocket.h.
Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:32:05 EDT 2009 |