net-connect timeout

Started by kanen, March 31, 2010, 06:34:58 PM

Previous topic - Next topic

kanen

Searched, but couldn't find an answer. I am not the most patient forum searcher, tho...



Is there a way to specify a net-connect timeout value so I do not spend too long trying to connect to a port that is not open or a system that is not online?



The default value, whatever it is, is too long for what I am doing and I need a shorter timeout.
. Kanen Flowers http://kanen.me[/url] .

Lutz

#1
The C socket API, on which the newLISP net-xxx API is based, does not offer to set a timeout fosocket connection call. On UNIX this timeout is a kernel setting. On Mac OS X and other BSDs, you could use the sysctl shell utility to change this setting, and you could do that from inside newLISP using (exec "sysctl ...") with the appropiate ... specification.

kanen

#2
I get the impression this conversation sounds familiar to you. Didn't we have this exact same conversation at kozoru? :)



I suppose I am going to write a packet library for newLISP, then. As I need to be able to construct packets of arbitrary timeouts and with arbitrary header and payloads.



Has anyone written a libnet newLISP wrapper yet? If so, I would love to play with it.


Quote from: "Lutz"The C socket API, on which the newLISP net-xxx API is based, does not offer to set a timeout fosocket connection call. On UNIX this timeout is a kernel setting. On Mac OS X and other BSDs, you could use the sysctl shell utility to change this setting, and you could do that from inside newLISP using (exec "sysctl ...") with the appropiate ... specification.
. Kanen Flowers http://kanen.me[/url] .

kanen

#3
This, as you know, irritates me.



So, I wrote a port-knocking program (in C) which should compile on any version of Linux/BSD/Windows, assuming you have a C compiler installed. It constructs a packet and connects to ports (like a port scanner), but it is so much faster than doing a net-connect.



Anyway, the .so imports into newLISP perfectly (of course) and I will post the code and examples here and/or my blog soon.



P.S. Loving newLISP again.


Quote from: "Lutz"The C socket API, on which the newLISP net-xxx API is based, does not offer to set a timeout fosocket connection call. On UNIX this timeout is a kernel setting. On Mac OS X and other BSDs, you could use the sysctl shell utility to change this setting, and you could do that from inside newLISP using (exec "sysctl ...") with the appropiate ... specification.
. Kanen Flowers http://kanen.me[/url] .

Lutz

#4
A few years back, I experimented with raw sockets trying to write a 'net-packet' function, but could not get it too work, even the pure C examples. I am definitely interested in the C code!

kanen

#5
Code and examples in newLISP posted: http://www.lifezero.org">//http://www.lifezero.org - under the title "port-knock'n"



Next up, a RAW Packet Creation library for newLISP. :)
. Kanen Flowers http://kanen.me[/url] .