maxy has asked for the wisdom of the Perl Monks concerning the following question:
and i am calling it like this: &rdt_listen($ARGV[1]) thanx in advancesub listen{ use IO::Socket; my $port1 = @_; $proto = 'udp'; $socket1 = new IO::Socket::INET (LocalPort => $port1,Proto=> $proto)or + die "Cannot Listen On The Socket $@"; print " Waiting for connection\n"; my $MAX_TO_READ = 512; my $datagram; while (1){ $server->recv($datagram,$MAX_TO_READ); if($datagram ne '') { print "\nReceived message '", $datagram,"'\n"; } # If client message is empty exit else { print "Cilent has exited!"; exit 1; } return $server; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UDP Server
by Your Mother (Archbishop) on Dec 01, 2008 at 23:26 UTC | |
by maxy (Novice) on Dec 01, 2008 at 23:37 UTC |