20 #pragma comment(lib, "WS2_32.LIB") 26 #include <sys/socket.h> 30 #include <arpa/inet.h> 32 #include <netinet/in.h> 33 #include <sys/ioctl.h> 34 #include <sys/socket.h> 35 #include <sys/types.h> 42 unsigned short listenPort,
const std::string& IPaddress,
52 WORD wVersionRequested;
55 wVersionRequested = MAKEWORD(2, 0);
57 if (0 != WSAStartup(wVersionRequested, &wsaData))
61 setupSocket(listenPort, IPaddress, maxConnectionsWaiting);
#define MRPT_TRY_END
The end of a standard MRPT "try...catch()" block that allows tracing throw the call stack after an ex...
VerbosityLevel
Enumeration of available verbosity levels.
#define THROW_EXCEPTION(msg)
std::string getLastErrorStr()
Returns a description of the last Sockets error.
mrpt::system::COutputLogger COutputLogger
unsigned int m_serverSock
The handle for the listening server TCP socket.
#define MRPT_TRY_START
The start of a standard MRPT "try...catch()" block that allows tracing throw the call stack after an ...
void setupSocket(unsigned short listenPort, const std::string &IPaddress, int maxConnectionsWaiting)
Common code called from the platform-dependant constructor.
void setVerbosityLevel(const VerbosityLevel level)
alias of setMinLoggingLevel()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
~CServerTCPSocket() override
Dtor.
Serial and networking devices and utilities.
CServerTCPSocket(unsigned short listenPort, const std::string &IPaddress=std::string("127.0.0.1"), int maxConnectionsWaiting=50, mrpt::system::VerbosityLevel verbosityLevel=mrpt::system::LVL_INFO)
Constructor that creates the socket, performs binding, and start listening mode.