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
>>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to