nobot has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,
I have a socks listener on 127.0.0.1:4001
I use IO::Socket::Socks to create a socket to that listener.
like:
$conn = new IO::Socket::Socks (ProxyAddr => '127.0.0.1', ProxyPort => 4001) || die "$!\n";
Now I want to create and send raw tcp/ip packets through this socket.
I have tried to understand how to use NetPacket::IP and NetPacket::TCP
But all examples I have found on the net involves dealing
with received packages. Not how to create one from scratch
I read somewhere that you could initialize a IP package like:
my $ip = NetPacket::IP->('');
And then go ahead and fill out the contents like:
$ip->{ver} = 4; ...
But the empty initialization part crashes
Any ideas how to do this?

Replies are listed 'Best First'.
Re: raw packages through socks
by nobot (Novice) on Mar 15, 2007 at 22:02 UTC
    I found that:
    $ip_obj = NetPacket::IP->decode();
    creates an empty hash, which I can fill with the contents.
    So now i know how to create and send packages through a raw socket
    But I dont know how to send them through the sock socket
    Maybe It is as simple as:
    print $conn $raw_tcp_pkg;
    ?