16 #include "../../stdafx.h"
17 #include "../../debug.h"
21 #include "../../safeguards.h"
29 packet_queue(NULL), packet_recv(NULL),
30 sock(s), writable(false)
34 NetworkTCPSocketHandler::~NetworkTCPSocketHandler()
38 if (this->
sock != INVALID_SOCKET) closesocket(this->
sock);
39 this->
sock = INVALID_SOCKET;
68 assert(packet != NULL);
112 int err = GET_LAST_ERROR();
113 if (err != EWOULDBLOCK) {
116 DEBUG(net, 0,
"send failed with error %d", err);
167 int err = GET_LAST_ERROR();
168 if (err != EWOULDBLOCK) {
170 if (err != 104)
DEBUG(net, 0,
"recv failed with error %d", err);
198 int err = GET_LAST_ERROR();
199 if (err != EWOULDBLOCK) {
201 if (err != 104)
DEBUG(net, 0,
"recv failed with error %d", err);
231 fd_set read_fd, write_fd;
237 FD_SET(this->
sock, &read_fd);
238 FD_SET(this->
sock, &write_fd);
240 tv.tv_sec = tv.tv_usec = 0;
241 #if !defined(__MORPHOS__) && !defined(__AMIGA__)
242 if (select(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv) < 0)
return false;
244 if (WaitSelect(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv, NULL) < 0)
return false;
248 return FD_ISSET(this->
sock, &read_fd) != 0;