Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
testing ports with ztcpsys
- X-seq: zsh-users 12429
- From: antho.charles@xxxxxxxxx
- To: zsh-users@xxxxxxxxxx
- Subject: testing ports with ztcpsys
- Date: Mon, 14 Jan 2008 18:35:47 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:subject:message-id:mime-version:content-type:content-disposition:user-agent:from; bh=uuL0mvu06VLsxSYc05ZvR4FULDBrmPd6d/cTVjhCt+E=; b=jf3Embd5S66H3JA5ykQ5+IqwZNi2W7Jynzxt0TsZx4o+DI1YcX4zR8k2mOaAdparUuVy6tW9yNBO0fe6U1LFEaFQPIBC2eprZLzoz2tgurPgaepa99uzpvzx/AikW78N4k1Q7u3IVRQl+1EwWcPZXnINVInSMQSn0WB+TIVJFeI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:subject:message-id:mime-version:content-type:content-disposition:user-agent:from; b=sUUF8BBFEq7rpH/3kY7teNuuUETeaM8SOv6py8PlchDkMRzwiPtC08G/FTCCGoE7F0jvSqbHz4Q8kyGxk1aHVuclYEvaTbZkoSunpZHF9fAQoVGyEF3CT3cblQcGxq+xkx057mqPOCE24vsZf1FJPSzyzp9ismxrqaBTsnUzMRA=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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