TCP connections work on Windows now.

This commit is contained in:
Adam Ierymenko 2014-03-28 12:26:33 -07:00
parent 9c68a343f6
commit e8b613e625
2 changed files with 22 additions and 7 deletions

View file

@ -164,6 +164,16 @@ bool TcpSocket::notifyAvailableForWrite(const SharedPtr<Socket> &self,SocketMana
if (_outptr) {
int n = (int)::send(_sock,(const char *)_outbuf,_outptr,0);
#ifdef __WINDOWS__
if (n == SOCKET_ERROR) {
switch(WSAGetLastError()) {
case WSAEINTR:
case WSAEWOULDBLOCK:
break;
default:
return false;
}
#else
if (n <= 0) {
switch(errno) {
#ifdef EAGAIN
@ -179,6 +189,7 @@ bool TcpSocket::notifyAvailableForWrite(const SharedPtr<Socket> &self,SocketMana
default:
return false;
}
#endif
} else memmove(_outbuf,_outbuf + (unsigned int)n,_outptr -= (unsigned int)n);
}