File: udp.pl

package info (click to toggle)
libio-socket-socks-perl 0.74-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 340 kB
  • sloc: perl: 2,904; makefile: 12
file content (25 lines) | stat: -rwxr-xr-x 462 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env perl

use lib '../lib';
use IO::Socket::Socks;
use Socket;
use strict;

# daytime UDP client

my $sock = IO::Socket::Socks->new(
    UdpAddr => 'localhost',
    UdpPort => 13,
    ProxyAddr => 'localhost',
    ProxyPort => 1080,
    SocksDebug => 1
) or die $SOCKS_ERROR;

my $peer = inet_aton('localhost');
$peer = sockaddr_in(13, $peer);

$sock->send('!', 0, $peer) or die $!;
$sock->recv(my $data, 50)  or die $!;
$sock->close();

print $data;