54 TcpSocket::TcpSocket()
58 TcpSocket::~TcpSocket()
62 CLOSE(this->getSockHandle());
65 int TcpSocket::rawSendBytes(
char *buffer,
shared_int num_bytes)
67 int rc = this->SOCKET_FAIL;
69 rc = SEND(this->getSockHandle(), buffer, num_bytes, 0);
74 int TcpSocket::rawReceiveBytes(
char *buffer,
shared_int num_bytes)
76 int rc = this->SOCKET_FAIL;
78 rc = RECV(this->getSockHandle(), buffer, num_bytes, 0);
83 bool TcpSocket::rawPoll(
int timeout,
bool & ready,
bool & error)
86 fd_set read, write, except;
87 int rc = this->SOCKET_FAIL;
93 time.tv_sec = timeout / 1000;
94 time.tv_usec = (timeout % 1000) * 1000;
100 FD_SET(this->getSockHandle(), &read);
101 FD_SET(this->getSockHandle(), &except);
103 rc = SELECT(this->getSockHandle() + 1, &read, &write, &except, &time);
105 if (this->SOCKET_FAIL != rc) {
109 if (FD_ISSET(this->getSockHandle(), &read)) {
113 else if(FD_ISSET(this->getSockHandle(), &except)) {
118 LOG_WARN(
"Select returned, but no flags are set");
123 this->logSocketError(
"Socket select function failed", rc, errno);