Jump to content
Sign in to follow this  

TCP/Array problem....

Recommended Posts


Need help getting the TCPSend command to send an array...

$header = DllStructCreate("ubyte var1;ubyte var2;ubyte var3;ubyte var4;ubyte var5;ubyte var6;ubyte var7;ubyte var8")
$header1 = DllStructCreate("ubyte var1;ubyte var2")


Dim $sendheader[10]
$sendheader[0] = DllStructGetData($header,1)
$sendheader[1] = DllStructGetData($header,2)
$sendheader[2] = DllStructGetData($header,3)
$sendheader[3] = DllStructGetData($header,4)
$sendheader[4] = DllStructGetData($header,5)
$sendheader[5] = DllStructGetData($header,6)
$sendheader[6] = DllStructGetData($header,7)
$sendheader[7] = DllStructGetData($header,8)
$sendheader[8] = DllStructGetData($header1,1)
$sendheader[9] = DllStructGetData($header1,2)

_ArrayDisplay($sendheader, "Whole array" ) ;This confirmed the array is set up with the information i want after having it displayed...
; I connect to my LAN server
$socket = TCPConnect( $ip, $port)
: I send the the packet in ubyte array formation...
TCPSend($socket, $sendheader)
; test server shows this Client Connected:
; but it doesnt show any data sent from the tcpsend command
; i dont know why it doesnt show any data because
; ive sent data in ubyte by the tcpsend command and it works but when i try to send a array in ubyte formation it doesnt work....
; but my guess at this point is for some reason the tcpsend command cant sent an array that is in ubyte formation?

Also I dont get any errors when running the script...

Edited by Shimgreen

Share this post

Link to post
Share on other sites

Nope, it's not the way to do it. You need to send each subscript a time. Example:

For $i = 0 To UBound($sendheader)-1
    TCPSend($socket, $sendheader[$i])

Try for example this: ConsoleWrite($sendheader & @LF) and you'll see why it's not working.

if you need the receiver to get the chunk as it is and not break the receiver it's functionality of waiting to a chunk of data you can create a pipe '|' separated string of the chunk and send it as a whole. The receiver will then split it on pipes.

Edited by Authenticity

Share this post

Link to post
Share on other sites

Thanks for the fast help Authenticity.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this