C
c|sc0
Hi,
I just want to write raw data to a socket (by using IO::Socket)
All I want to do is the following:
print $my_socket "\x0f\xa1\x02.....and much more here";
A part of the data is actually an IP address
so in my case if I want to send "10.1.2.3" I should send "\x0a\01\x02\x3"
I tried to create a sub() to generate the "\x0a\01\x02\x3" out of
"10.1.2.3", but I failed.
Obviously the following does not work:
$code .= "\\x" . substr( unpack("H*", pack("N*", $my_byte)) , -2 ,2);
I tried many more ways but still can't achieve it.
I'd like to do such a sub() for "string" as well
e.g "ABC" should give "\x41\x42\x43"
but as you already understood, i dont want the string "\x41\x42\x43" but
the actually value behind it.
Can you guys give a tip ?
thanks
C|sc0-
I just want to write raw data to a socket (by using IO::Socket)
All I want to do is the following:
print $my_socket "\x0f\xa1\x02.....and much more here";
A part of the data is actually an IP address
so in my case if I want to send "10.1.2.3" I should send "\x0a\01\x02\x3"
I tried to create a sub() to generate the "\x0a\01\x02\x3" out of
"10.1.2.3", but I failed.
Obviously the following does not work:
$code .= "\\x" . substr( unpack("H*", pack("N*", $my_byte)) , -2 ,2);
I tried many more ways but still can't achieve it.
I'd like to do such a sub() for "string" as well
e.g "ABC" should give "\x41\x42\x43"
but as you already understood, i dont want the string "\x41\x42\x43" but
the actually value behind it.
Can you guys give a tip ?
thanks
C|sc0-