Hello, I've been teaching myself on how to code with perl. My current project that I am working on is socket programming. I would like to transmit a message from one server to another. When I attempt to execute my client code, the following error displays, "send: Cannot determine peer address at ./myfirstcallsock.pl line 11"

#!/usr/bin/env perl
use strict;
use warnings;
use IO::Socket;
my $sock1 = new IO::Socket::INET (
        PeerAdder => '<REMOVED-FROM-PUBLIC>',
        PeerPort => '7070',
        Proto => 'tcp',
        );
my $msg="Hello, the message was successfully sent!\n";
$sock1->send($msg);
close($sock1);

The "<REMOVED-FROM-PUBLIC>" lists the destination address that I am attempting to connect to. I've moved this script on the same server and replace the ip address with '127.0.0.1" but I still get the same error. Any help is appreciated.

Recommended Answers

All 3 Replies

PeerAdder is a typo. It's supposed to be PeerAddr.

Thanks, that resolved the issue!!!

Good. Mark it solved please.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.