TCP/IP ports problem (bug ?)
[1/2] from: peoyli::algonet::se at: 24-Apr-2001 12:19
Wrote a small port scanner, which just tries to open a range of ports,
and closes them directly afterwards..
With the Amiga version of REBOL/Core and /View, I can't open any port
at all after running the test against another of my systems (unix
machine with a lot of services running)
I get the same problem with the UNIX versions, but here I can open and
close more ports before failing.. Quitting and restarting REBOL lets
me open ports again.
/PeO
scan-ports: func [
ip [string! tuple!] {IP address to scan}
start-port [integer!] {First port to test}
end-port [integer!] {Last port to test}
/local port-num test-port fail success
][
fail: 0
success: 0
port-num: start-port
num-ports: end-port - start-port + 1
loop num-ports [
either error? try [test-port: open to-url rejoin ["tcp://" ip ":" port-num]] [
; print "nope"
fail: fail + 1
][
success: success + 1
print [port-num "is open"]
close test-port
]
port-num: port-num + 1
if port-num // 1000 = 0 [prin ["at" port-num " "]]
]
print [newline "Failed to open " fail " ports, " success " ports opened"]
]
----------------------------------------------------------
>> do %portscan.r
Script: "Untitled" (none)
>> scan-ports 172.16.0.5 1 53
7 is open
9 is open
13 is open
19 is open
21 is open
23 is open
25 is open
37 is open
53 is open
Failed to open 44 ports, 9 ports opened
>> scan-ports 172.16.0.5 1 53
7 is open
9 is open
13 is open
19 is open
21 is open
23 is open
25 is open
Failed to open 46 ports, 7 ports opened
>> scan-ports 172.16.0.5 1 53
Failed to open 53 ports, 0 ports opened
>> test-port: open tcp://172.16.0.5:7
** Access Error: Error opening socket 172.16.0.5
** Near: test-port: open tcp://172.16.0.5:7
[2/2] from: ryanc:iesco-dms at: 24-Apr-2001 11:08
Good one PeO,
I cant find any work arounds. Interesting bit of behavior, scanning an openable port
over and over has no ill effect. Scanning a failed to open port has no ill effects
for exactly 1019 times. On the 1020 all hell breaks loose, you cant even open local
files.
--Ryan
P-O Yliniemi wrote:
> Wrote a small port scanner, which just tries to open a range of ports,
> and closes them directly afterwards..
<<quoted lines omitted: 62>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400
I am enough of an artist to draw freely upon my imagination.
Imagination is more important than knowledge. Knowledge is
limited. Imagination encircles the world.
-Einstein
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted