[H-GEN] testing network connectivity with perl

Andrae Muys andrae.muys at braintree.com.au
Wed Aug 27 01:04:48 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

Conor Cunningham wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and     ]
> [ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
> 
> Hello,
> 
> I'm currently writing a script that simply pings a UNIX box every sixty 
> seconds
> and logs any failed pings. However, I have been asked to connect to an 
> ORACLE port on the same UNIX box and log if the connection ever drops out.
> 
> The connection sometimes drops out, but only for a split second, and we 
> need to prove this fact with logs files.
> 
> So to start off, I connect to the ORACLE port using IO::Socket and log 
> success or failure.
> 
> I then enter a while(1) loop and do an
> 
> if(!connection) {log failure}
> 
> How I have been testing this is to simply unplug the network cable from 
> my laptop, then replug it. The connection has been broken, but according 
> to debugging, perl seems to think that the socket is still 
> connected/functioning. This is proved by PERL entering an if statement 
> which has a condition to enter only if the socket is "connected".
> 

As Mark has already pointed out, you will need to define "connection 
dropped" better before we can really assist.  OTOH what you appear to be 
trying to do is literally impossible by design.

I suggest you run tcpdump or ethereal (or some other protocol analyser) 
on the same host as your script and note the distinct lack of data 
associated with a break in your connection.

What exactly is it you are trying to measure?

A short increase in connection latency?
An errant FIN/RST from the Oracle host?
A momentary loss of CD on the Ethernet?


-- 
  Andrae Muys    <andrae.muys at braintree.com.au>
  Engineer       Braintree Communications
   "Now, allowing captured continuations to be inspected and altered at
    runtime (including binding mutation, complete rebinding of scopes,
    and call tree mutation)...  *that* is really evil.  And, I should
    point out, quite useful."        - Dan Sugalski



--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list