TCP-Opened Socket

04/03/2016 16:33 alexutu2013#1
Hi all, can some1 explain, how can I send packets like : 0000 53 7c 45 4D 50 0A 00 to a opened socket? I've tried to search on forum and google..but that didn't helped me at all...thx :handsdown:
04/03/2016 17:23 Deverixz#2
Take a look at the _HexToString() Function, included in the String.au3
04/03/2016 19:20 alexutu2013#3
I know..but..how to send it with spaces like it is in first post..I should put it in an array or how?
and can you give me please, a simple example?
04/03/2016 21:13 elmarcia#4
So u want to send byte array as raw text or want to send that bytes as a packet byte array...

two ways:

Way1 (send raw data)

Way2 (send message byte array)
04/03/2016 22:03 alexutu2013#5
2nd way thanks a lot <3 #closerequest
04/04/2016 14:53 FacePalmMan#6
There you have a code for translating the Bytes you have into functioning hex string (and if you set $iSendRaw to False, also to a string of maybe readable characters):
Code:
TCPStartup()

$hSocket = TCPConnect("127.0.0.1",1234)

Global $iSendRaw = True ;Try both True and False. Both should work
Global $sString = "0000 53 7c 45 4D 50 0A 00" ;Or ClipGet()
$sString = "0x" & StringReplace($sString, " ", "")
If Not $iSendRaw Then $sString = BinaryToString($sString)
TcpSend($hSocket, $sString)
(untested, but should work)
04/05/2016 13:31 Lawliet#7
#closed