Shimgreen Posted April 25, 2009 Share Posted April 25, 2009 (edited) 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") DllStructSetData($header,1,"$E") DllStructSetData($header,2,"$R") DllStructSetData($header,3,$bin2) DllStructSetData($header,4,$bin) DllStructSetData($header,5,$nu) DllStructSetData($header,6,$nu1) DllStructSetData($header,7,$nu3) DllStructSetData($header,8,$nice) DllStructSetData($header1,1,"$A") DllStructSetData($header1,2,"$E") 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: 127.0.0.1 ; 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 April 25, 2009 by Shimgreen Link to comment Share on other sites More sharing options...
Authenticity Posted April 25, 2009 Share Posted April 25, 2009 (edited) 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]) Next 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 April 25, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Shimgreen Posted April 25, 2009 Author Share Posted April 25, 2009 Thanks for the fast help Authenticity. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now