summaryrefslogtreecommitdiff
path: root/test/aux-fixed/0601.udpserver
blob: 5513402b06101721cee964118e2c91b5fc1574c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
use IO::Socket::INET;
use IO::Select;

if (fork != 0) {
  sleep 1;
  exit 0;
}

my ($select,$socket,$received_data);

$socket = new IO::Socket::INET (
  LocalPort => '1223',
  Proto => 'udp',
) or die "ERROR in Socket Creation : $!\n";

$select = IO::Select->new($socket) or die "IO::Select $!";

if (scalar ($select->can_read(5)) == 1) {
	$socket->recv($recieved_data,1024);
	print "received: $recieved_data\n";
}