I am having an issue stemming from IO/Socket.pm on or around line 251.
croak 'send: Cannot determine peer address'
unless($peer);
Basically we are opening a connection up, and sending data to it. For some reason after 10-20 seconds this error gets thrown.
send: Cannot determine peer address
Any ideas??
#!/usr/bin/perl
package Dialer;
use Data::Dumper;
use IO::Socket;
$sock = IO::Socket::INET->new(PeerAddr => '255.255.255.255',
PeerPort => '5038',
Proto => 'tcp');
$res = $sock->send("Action: Login\r\nUsername: dunzo\r\nSecret: 123456789\r\nEvents: \r\n\r\n");
sleep(5);
while(1==1) {
$res = $sock->send("Action: Originate\r\nChannel: Local/123123@dunzodial\r\nExten: 123123\r\nContext: dunzo\r\nTimeout: 60000\r\nVariable: \r\nAsync: yes\r\nCallerID:
1234567890\r\nPriority: 1\r\n\r\n");
$incr++;
sleep(1);
print $incr."\n";
}
For TCP protocol,
255.255.255.255isn’t a valid unicast IP address. In this case, IO::Socket::INET treat255.255.255.255as a domain name. It will request the IP address by query your DNS server with host name255.255.255.255. Obviously there isn’t such a record, the DNS query operation will be timeout. That’s why you got error after 10~20 seconds.