How to tell if a port is open/closed ?
[1/3] from: arolls:bigpond:au at: 20-Aug-2001 14:33
I have a server like this:
server-port: open/direct/no-wait/lines tcp://:4321
connection-port: first server-port
append ports: copy [] connection-port
; client connects and disconnects...
; disconnect all
foreach port ports [if port [close port]]
** Access Error: Port none not open
** Where: disconnect
** Near: close port
This happens if I try to close it twice,
but I was hoping the test:
if port [close port]
would only try to close ports for open ports.
** How do I tell if a port is open?
Merci,
Anton.
[2/3] from: petr:krenzelok:trz:cz at: 20-Aug-2001 7:12
Hi,
what about try to catch error?
try [close port]
-pekr-
Anton wrote:
[3/3] from: arolls::bigpond::net::au at: 20-Aug-2001 16:53
Well, that's what I'm now doing,
but I thought there should be a
way to see if port is open first.
I tried
if port? port [close port]
as Tim suggested, but I get the same error.
Anyway, it's resolved by catching the error.
Regards,