You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
462 B
Perl

#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket;
my $host = 'localhost';
my $port = 4444;
my $client = new IO::Socket(
Domain => PF_INET,
Proto => 'udp',
);
die "Unable to create socket: $!\n" unless $client;
my $servaddr = sockaddr_in($port, inet_aton($host));
$client->send("Hello from client", 0, $servaddr) or die "Send: $!\n";
my $message;
$client->recv($message, 1024, 0);
print "Response was: $message\n";