[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Listen on a TCP port - NetServer::Generic



So our vendor is claiming that TCP connections from our network aren't
reaching them on port 1022. We must be blocking our outbound connections
in our firewall or something. 

Nope. Proved them wrong w/ Perl:

--------
#!/usr/bin/perl

use NetServer::Generic;
use FileHandle;

my ($foo) = new NetServer::Generic;
$foo->port(1022);
$foo->callback(\&dowork);
$foo->hostname('razorbill');
$foo->mode("forking");
print "Starting server\n";
open (LOG, ">log.txt");
LOG->autoflush;
$foo->run();
close LOG;


sub dowork {
   my ($s) = shift;
   while (defined ($tmp = <STDIN>)) {
      print "You said: $tmp";
      print LOG $tmp;
   }
}
--------

Launched that script out on a Linux server on the Internet, connected to
it from our network, and watched it talk back to me. No problems on our
side, vendor. :)

Handy little gizmo, NetServer::Generic.

j