Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

testing ports with ztcpsys



Hi,

I'm writing a script that gather some system informations on several
computers, and I want to test if some ports are in use. I think netcat is
good, but I remember that zsh have a tcp module so I try:

-- code --
#!/bin/zsh
autoload -U tcp_open

tcp_open "$1" "$2" &> /dev/null
[[ $? -eq 1 ]] && exit 1 || tcp_close &>/dev/null && exit 0
-- end code --

It works but when the host doesn't respond ( you can try tcp_open
www.google.fr 8080 for example ), the timeout is really long and slow the script.

So, I try with ztcp, checking $REPLY value but it doesn't work: $REPLY
is set in the same shell than the ztcp command, so I should wait for
the ztcp to return before I can check $REPLY.
My question is:  
is there a way to hack a timeout ?


-- 
Anthony CHARLES

Attachment: signature.asc
Description: Digital signature



Messages sorted by: Reverse Date, Date, Thread, Author