Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 10th, 2005, 3:29 AM   #1
opcis
Newbie
 
Join Date: Feb 2005
Posts: 1
Rep Power: 0 opcis is on a distinguished road
connection reset by peer / bad file descriptor

I wrote a whois program in perl. Here is the connection part of the program:

use IO:ocket;
$remote="whois.crsnic.net";
$sock=IO:ocket::INET->new(Proto=>'tcp',PeerAddr=>"$remote:43");
$sock->print("domain $dm.$tld\n") ;
my @result=$sock->getlines;
close($sock);

When running the program it freezes at random points. Sometimes after scanning 10 domains other times after a couple hundred. I'm getting the following errors:

1. Connection reset by peer
This occurs on
my @result=$sock->getlines;
It happens quite often and sometimes freezes completely after printing this error.

2. Bad file descriptor
This error occurs on
$sock=IO:ocket::INET->new(Proto=>'tcp',PeerAddr=>"$remote:43");
It happens sometimes and often freezes completely after printing this error.

3. Operation now in progress
This error occurs on
$sock=IO:ocket::INET->new(Proto=>'tcp',PeerAddr=>"$remote:43");
It happens less often than the other errors and doesn't appear to freeze the program.

4. Unknown error
This error occurs on
$sock=IO:ocket::INET->new(Proto=>'tcp',PeerAddr=>"$remote:43");
It's only happened 3 times and I'm not sure why. It doesn't seem to freeze the program.


Those are the 4 errors I have seen when testing the program. It is completely random. Sometimes it works just fine and other times prints one of those errors and freezes. Sometimes it just freezes without printing anything. I have tried setting a timeout and tried several different variations of the code with different modules for making the connection to the whois server. I have tried the code on Windows and Linux at different locations, but I still get one of those errors and it usually freezes afterward. I have placed print statements throughout to make sure I wasn't stuck in an infinite loop somewhere. I have run out of ideas. Can anyone help?
opcis is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC