in reply to A Simple Server/Client implementation

If these two users are behind broadband routers you can try asking the router to forward a port using Universal Plug and Play.
There's even a module at the CPAN for it: Net::UPnP.

Through UPnP is how file sharing applications and other peer-to-peer application can correctly work behind NAT layers.

Unfortunately, I don't know if corporate routers support it - I suppose they don't.
But pretty much every broadband router, wifi access points, etc, supports UPnP nowadays.


acid06
perl -e "print pack('h*', 16369646), scalar reverse $="
  • Comment on Re: A Simple Server/Client implementation

Replies are listed 'Best First'.
Re^2: A Simple Server/Client implementation
by Ace128 (Hermit) on Mar 07, 2006 at 00:44 UTC
    Hmm, interesting... Gotta check that module... Thanks.

    UPDATE: Well well.. runing the example mentioned in the module gives nothing... on reading some more about this on the webb...
      Specifically, you should look at Net::UPnP::GW::Gateway.
      This is the UPnP device that represents an internet gateway.


      acid06
      perl -e "print pack('h*', 16369646), scalar reverse $="
        Ok, runing the script mentioned there too didnt do much... Do I need some special hardware for this to work or what? When I run:
        use strict; use warnings; #use diagnostics; use lib "."; use Net::UPnP::ControlPoint; use Net::UPnP::GW::Gateway; my $obj = Net::UPnP::ControlPoint->new(); my $retry_cnt = 0; my @dev_list = (); while (@dev_list <= 0 || $retry_cnt > 5) { #@dev_list = $obj->search(st =>'urn:schemas-upnp-org:device:Intern +etGatewayDevice:1', mx => 10); @dev_list = $obj->search(st =>'upnp:rootdevice', mx => 3); $retry_cnt++; print Dumper(@dev_list); } my $devNum = 0; foreach my $dev (@dev_list) { my $device_type = $dev->getdevicetype(); if ($device_type ne 'urn:schemas-upnp-org:device:InternetGatewayD +evice:1') { next; } print "[$devNum] : " . $dev->getfriendlyname() . "\n"; unless ($dev->getservicebyname('urn:schemas-upnp-org:service:WANIP +Connection:1')) { next; } my $gwdev = Net::UPnP::GW::Gateway->new(); $gwdev->setdevice($dev); print "\tExternalIPAddress = " . $gwdev->getexternalipaddress() . +"\n"; print "\tPortMappingNumberOfEntries = " . $gwdev->getportmappingnu +mberofentries() . "\n"; my @port_mapping = $gwdev->getportmappingentry(); my $port_num = 0; foreach my $port_entry (@port_mapping) { if ($port_entry) { my $port_map_name = $port_entry->{'NewPortMappingDescripti +on'}; if (length($port_map_name) <= 0) { $port_map_name = "(No name)"; } print " [$port_num] : $port_map_name\n"; foreach my $name ( keys %{$port_entry} ) { print " $name = $port_entry->{$name}\n"; } } else { print " [$port_num] : Unknown\n"; } $port_num++; } }
        the array @dev_list is empty... so, what am I missing here?