Re: [MacPerl-Modules] IO::Socket client mode
[email protected] (Chris Nandor) Wed, 5 Sep 2001 16:39:41 -0400
| Newsgroups | perl.macperl.modules,perl.macperl.toolbox |
|---|---|
| Message-ID | <p05100306b7bc3d24405d@[10.0.1.177]> |
At 11:01 -0500 2001.09.05, [email protected] wrote: >Hi, I'm unable to use IO::Socket in MacPerl to successfully run a >TCP/IP socket "client." I am able to use it successfully in "server" >mode (where I do a "listen"), but every time I attempt to use it >in "client" mode (where I call the remote host), I cannot establish >a connection. The following line always takes the "die": > > $socket = IO::Socket::INET->new(Proto=>"tcp", >PeerAddr=>'64.58.76.226', PeerPort=>"80", Reuse=>1) > or die "Can't connect to 64.58.76.226\n"; > >It doesn't matter what IP address I use (the one I used here is Yahoo). >Can anyone tell me what I'm doing wrong? >Please copy my email address on any replies. Try it without Reuse => 1. It seems to fail on MacPerl 5.2.0r4, but works on MacPerl 5.6.1a5. Under 5.6.1a5 this works: use IO::Socket; my $socket = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "64.58.76.226", PeerPort =>"80", Reuse =>1 ) or die "Can't connect to 64.58.76.226\n"; print $socket "GET / HTTP/1.0\015\012\015\012"; s/\015?\012/\n/g, print while <$socket>; The same script works in 5.2.0r4 if I don't include Reuse => 1. -- Chris Nandor [email protected] http://pudge.net/ Open Source Development Network [email protected] http://osdn.com/