Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use autodie;
- use IO::Socket::INET;
- $| = 1;
- my ($socket,$data);
- $socket = new IO::Socket::INET (
- LocalAddr => 'localhost',
- LocalPort => 2323,
- Proto => 'udp'
- );
- my ($datagram,$flags);
- while (1) {
- $socket->recv($datagram, 42, $flags);
- print "Received datagram from ", $socket->peerhost,", flags ", $flags || "none", ": $datagram\n";
- }
- $socket->close();
- exit(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement