61 const int reuse_addr = 1;
63 SOCKLEN_T addrSize = 0;
65 rc = SOCKET(AF_INET, SOCK_STREAM, 0);
78 this->
sockaddr_.sin_addr.s_addr = INADDR_ANY;
79 this->
sockaddr_.sin_port = HTONS(port_num);
86 LOG_INFO(
"Server socket successfully initialized");
97 LOG_ERROR(
"Failed to set socket to listen");
103 LOG_ERROR(
"Failed to bind socket, rc: %d", rc);
111 LOG_ERROR(
"Failed to create socket, rc: %d", rc);
123 int disableNodeDelay = 1;
147 LOG_WARN(
"Failed to set no socket delay, errno: %d, sending data can be delayed by up to 250ms", err);
154 LOG_ERROR(
"Failed to accept for client connection");
160 LOG_WARN(
"Tried to connect when socket already in connected state");
virtual void setConnected(bool connected)
#define LOG_WARN(format,...)
#define LOG_ERROR(format,...)
sockaddr_in sockaddr_
address/port of remote socket
#define LOG_INFO(format,...)
bool makeConnect()
connects to the remote host
#define LOG_DEBUG(format,...)
bool isConnected()
return connection status
void setSrvrHandle(int srvr_handle_)
static const int SOCKET_FAIL
socket fail return value
int getSrvrHandle() const
int getSockHandle() const
bool init(int port_num)
initializes TCP server socket. The connect method must be called following initialization in order to...
void setSockHandle(int sock_handle_)