use IO::Socket::IP and fix null reply
[spider.git] / perl / DXUDP.pm
index d9dda00cdbce80c7c5462965fffe28e1c8a22fc6..fda14c6f8680ff43e9f1b1cae09adfa641b16810 100644 (file)
@@ -108,7 +108,7 @@ sub start {
        my $host = $args->{LocalAddr} || $args->{host} || '0.0.0.0';
        my $port = $args->{LocalPort} || $args->{port} || 1234;
        
-    $socket = IO::Socket::INET6->new(
+    $socket = IO::Socket::IP->new(
                   LocalAddr => $host,
                   LocalPort => $port,
                   Proto => 'udp',
@@ -140,6 +140,8 @@ sub _incoming {
        $self->emit(read => $datagram);
 }      
 
+has peerhost => sub { return $_[0]->{socket}->peerhost };
+has peerport => sub { return $_[0]->{socket}->peerport };
 
 sub DEMOLISH {
     my $self = shift;