Cricalix.Net

September 6, 2007

Port testing with perl

Filed under: $work — cricalix @ 17:11

Today, I had the joy of trying to troubleshoot why server A couldn’t talk to server B on port 5432. Packet traces on server A showed that the far end (or something in the way) supposedly said RST, ACK to any connection in the app server pool once that connection timed out. Packet traces on the far end showed no connection at all, so I decided to use telnet to test the connection.

-bash: telnet: command not found

So, given that telnet didn’t exist, I tried perl. Yep, perl exists. IO::Socket::INET exists too.

Code time!

use IO::Socket::INET;
$socket = IO::Socket::INET->new(PeerAddr => '10.151.2.1', PeerPort=>'5432', Proto => 'tcp') or die $!;
$socket->close();

That proved that I was actually getting connectivity to server B, so we were able to chase other avenues to solve the problem (and did - Sun’s app server has 3 ways of verifying that connections in the pool are working, and only one of them actually tests the network connection).

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.


Powered by WordPress. Theme by H P Nadig