socket error

socket error

am 25.08.2007 00:51:46 von jis

use IO::Socket;

my $sock = new IO::Socket::INET (
PeerAddr => '144.xxx.31.142',
PeerPort => '9000',
Proto => 'tcp',
);
die "Could not create socket: $!\n" unless $sock;
print $sock "Hello Andy!\n";
close($sock);

The ip address belongs to a another system in the netrwork.

But i get an error "Could not create socket: Unknown error"

If i give my ip address if my own system i do not have any problems..
Is it because firewall stops me or ....

Pls help.

Cheers,
Jis

Re: socket error

am 25.08.2007 02:16:43 von xhoster

jis wrote:
> use IO::Socket;
>
> my $sock = new IO::Socket::INET (
> PeerAddr => '144.xxx.31.142',
> PeerPort => '9000',
> Proto => 'tcp',
> );
> die "Could not create socket: $!\n" unless $sock;
> print $sock "Hello Andy!\n";
> close($sock);
>
> The ip address belongs to a another system in the netrwork.
>
> But i get an error "Could not create socket: Unknown error"

Try looking in $@ instead of or in addition to $!

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB

Re: socket error

am 25.08.2007 15:34:29 von rvtol+news

jis schreef:

> my $sock = new IO::Socket::INET (
> PeerAddr => '144.xxx.31.142',
> PeerPort => '9000',
> Proto => 'tcp',
> );
> die "Could not create socket: $!\n" unless $sock;

It is easy to combine that:

my $sock = IO::Socket::INET->new(
PeerAddr => '144.xxx.31.142',
PeerPort => '9000',
Proto => 'tcp',
) or die "Could not create socket: ($!) ($@)\n";

--
Affijn, Ruud

"Gewoon is een tijger."