| |
|
cc 
| Socket server = new TcpSocket();
server.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true);
server.bind(new InternetAddress(8000));
server.listen(8);
auto set = new SocketSet();
set.add(server);
auto sel = Socket.select(set, null, null, msecs(0));
Socket.select(set, null, null, msecs(0));
(Simplified from loop) On the second select call, fails with:
std.socket.SocketOSException@std\socket.d(3439): Socket select error: An invalid argument was supplied.
The ultimate goal is non-blocking accept calls. I tried skipping the select() calls entirely and just setting server.blocking = false; and auto client = server.accept(); every loop, but this resulted in accept() returning a non-null Socket object even when no client was connecting, and did not throw an exception to check for wouldHaveBlocked. When I added the select statement to check for pending connections, the first iteration returns 0 successfully, but the second iteration of the loop failed with the above message.
(DMD32 D Compiler v2.071.1 running on Windows 7 x64)
|