[ale] question regarding how to see if a computer is listening on a port or rejecting connections..

James Sumners james.sumners at gmail.com
Thu Dec 1 11:51:26 EST 2011


#!/bin/bash
nc -vz printer.example.com 9100
if [ $? -eq 0 ]; then
  echo "All good cap'n!"
else
  echo "She's blown a gasket!"
fi

On Thu, Dec 1, 2011 at 11:04, David Ritchie <deritchie at gmail.com> wrote:
> ALE folk,
>    I suspect that this is something that someone else has already
> solved, so I thought I would pose the question to the ALE hive mind...
>
> I have a printer with a network interface. it is sporadically going on
> and off line within the TCP stack. For example, if you were to do a
>
>        telnet <IP address> 9100
>
> it would either connect, or refuse the connection. It typically stays
> down once it crashes.
>
> Pings always respond, but the TCP stack crashes and the only
> consistent way to get this
> to reset is to turn the printer off for 15 minutes (to allow the power
> to full go down on the internal network card). It will resume
> operation for a while
> until it hangs again. We have tried updating the cards, etc and are
> working (slowly) with the vendor to correct the problem.
>
> What I am looking for something that I can use to determine this kind
> of connection is failing. Looking for suggestions.. perhap nc could do
> this? (not
> really experienced with nc, but that comes to mind)...
>
> Best regards,
> Dave Ritchie



-- 
James Sumners
http://james.roomfullofmirrors.com/

"All governments suffer a recurring problem: Power attracts
pathological personalities. It is not that power corrupts but that it
is magnetic to the corruptible. Such people have a tendency to become
drunk on violence, a condition to which they are quickly addicted."

Missionaria Protectiva, Text QIV (decto)
CH:D 59



More information about the Ale mailing list