summaryrefslogtreecommitdiff
path: root/test/aux-fixed/0601.udpserver
blob: 2638ef55f6c1287d2249430c9fe80b9676d4a1a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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);
	select(undef, undef, undef, 0.5);
	print "received: $recieved_data\n";
}