send.pl 309 B

1234567891011121314151617
  1. #!/usr/bin/perl
  2. use IO::Socket::INET;
  3. my ($ip, $port, $file) = @ARGV;
  4. $ip and $port or die "Usage $0: <ip> <port>\n";
  5. $socket = new IO::Socket::INET->new( PeerPort => $port,
  6. Proto => 'udp',
  7. PeerAddr => $ip);
  8. open(I, $file);
  9. $/ = undef;
  10. my $buf = <I>;
  11. close(I);
  12. $socket->send("$buf\n");