Modify changes to test TCP socket.
Fork of Socket by
Diff: TCPSocketServer.cpp
- Revision:
- 10:d24738f4ef99
- Parent:
- 6:cd2e5559786d
- Child:
- 11:3d83c348fb8b
diff -r f972715add36 -r d24738f4ef99 TCPSocketServer.cpp --- a/TCPSocketServer.cpp Fri Jul 27 15:56:20 2012 +0000 +++ b/TCPSocketServer.cpp Tue Jul 31 11:50:55 2012 +0000 @@ -57,14 +57,15 @@ return 0; } -int TCPSocketServer::accept(TCPSocketConnection& connection, int timeout_ms) { +int TCPSocketServer::accept(TCPSocketConnection& connection) { if (_sock_fd < 0) return -1; - TimeInterval timeout(timeout_ms); - if (wait_readable(timeout) != 0) - return -1; - + if (!_blocking) { + TimeInterval timeout(_timeout); + if (wait_readable(timeout) != 0) + return -1; + } socklen_t newSockRemoteHostLen = sizeof(connection._remoteHost); int fd = lwip_accept(_sock_fd, (struct sockaddr*) &connection._remoteHost, &newSockRemoteHostLen); if (fd < 0)