Leser: 1
5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/usr/local/bin/perl use constant MYPORT => 10002; use constant REMOTEPORT => 10001; use constant REMOTEHOST => '192.168.23.1'; use constant STRING => 'PING'; use Socket; use IO::Socket; # create a socket my $sock = new IO::Socket::INET(LocalPort => MYPORT, Proto => 'udp') or die "Can't create socket: $!"; my ($remote,$input,$c); $remote = sockaddr_in(REMOTEPORT, inet_aton(REMOTEHOST)); my $rc = $sock->send(STRING,length(STRING),$remote); die "$! $@" unless $rc; $rc = $sock->recv($input,32768,0); die "$! $@" unless $rc; print "received: $input\n";
1
2
3
lxdata1(r41o):/tmp/forslog> perldoc -f send
send SOCKET,MSG,FLAGS,TO
send SOCKET,MSG,FLAGS
5 Einträge, 1 Seite |