You want to write a UDP server,
First bind to the port the server is to be contacted on. With IO::Socket, this is easily accomplished:
$server = IO::Socket::INET->new(LocalPort => $server_port,
Proto => "udp")
or die "Couldn't be a udp server on port $server_port : $@\n"; read more..