mbed socket API
Dependents: EthernetInterface EthernetInterface_RSF EthernetInterface EthernetInterface ... more
Deprecated
This is an mbed 2 sockets library. For mbed 5, network sockets have been revised to better support additional network stacks and thread safety here.
Diff: TCPSocketServer.cpp
- Revision:
- 10:d24738f4ef99
- Parent:
- 6:cd2e5559786d
- Child:
- 11:3d83c348fb8b
--- 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)
mbed official


