What you are attempting to do is open a TCP connection with a host on a
specific port. The open request is initiated by the application
(REBOL). Your TCP stack on your system actually handles the three way
handshake to open the connection. Without an "open" timeout in the
application, how long it takes for the open request to return to REBOL
depends upon how the remote host responds (assuming the host is there)
and timeout settings in the TCP stack. Some hosts will respond with an
ICMP message indicating the port is not available and that should be
very quick. Others may ignore the request in which case the TCP stack
timeout controls how long it will take to complete. UDP is another
story. Obviously, where actual communication occurs, network time
contributes to how long the open request takes.
There are also other ICMP messages the network may return which should
terminate the open request. If REBOL passes these status messages back,
assuming the TCP stack provides the reason for the failure to REBOL, you
may want to look at the error to decide what to do. For example if the
destination host is not available you don't need to go through a bunch
of connection attempts, because none of them will succeed.
And hopefully you are doing this program for a noble purpose. Internet
security people consider this type of program an indication of an
attempt to breach security--a hacker attack in progress.
Harold Grovesteen
Paul Tretter wrote:
> here is an example script thats a port scanner (my intent is to make it much
> more than that). Right now it has system/schemes/default/timeout: 1
>
> However if you change it to 0:0.5 it responds much slower - why?
>
> REBOL [
>
> Title: "Port Scanner"
> Author: "Paul Tretter"
> ]
>
> system/schemes/default/timeout: 1
>
>
> host: Ask "Enter ip address or fully qualified hostname
> ex.(ftp.microsoft.com) "
> port: to-integer Ask "Enter start port "
> End: to-integer Ask "Enter End port "
> newhost: rejoin [tcp:// host]
>
> while [(end + 1) <> port][
> getports: rejoin [newhost ":" port]
> either error? error: try [open getports][
> disarm error
> print ["nothing at port " port]
> ][
> print ["port " port " available"]
> ]
> port: port + 1
>
> ]
>
> halt
>
> ----- Original Message -----
> From: "Holger Kruse" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, April 09, 2001 7:10 PM
> Subject: [REBOL] Re: timeout
>
>
>
>> On Mon, Apr 09, 2001 at 06:02:50PM -0500, Paul Tretter wrote:
>>
>>> Actually this seems quite buggy on win platform (win2k here). I get a
>>
> much
>
>>> longer timeout period with "0:0.5" than I get with "1".
>>
>> Cannot be :). Keep in mind that as I mentioned before the timeout only
>> applies to individual reads, not to the other parts of communication,
>> such as DNS lookup, connecting to a site, sending a request to a site
>> etc.
>>
>> --
>> Holger Kruse
>> [EMAIL PROTECTED]
>>
>> --
>> To unsubscribe from this list, please send an email to
>> [EMAIL PROTECTED] with "unsubscribe" in the
>> subject, without the quotes.
>>
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.