On Wednesday, 16 March 2016 at 20:44:12 UTC, Lucien wrote:
Hello,

I want to know if a port of an ip address is listening, actually, I've this :
http://pastebin.com/pZhm0ujy
(checking port 22/ssh)

It works, but it took me ~10min to scan 30 addresses.

How can reduce the expiration delay ?

I don't know if they apply here, but you can lower the send and receive timeouts for the socket. I'm not sure which (or if either) of them you want to tweak.

https://dlang.org/library/std/socket/socket_option.html


import core.thread;  // for .seconds
s.setOption(SocketOptionLevel.SOCKET, SNDTIMEO, 10.seconds);
s.setOption(SocketOptionLevel.SOCKET, RCVTIMEO, 10.seconds);


I guess you could also use a non-blocking socket and decide yourself when enough time has passed to declare it a failed attempt.

Reply via email to