ruelas05 Posted July 9, 2014 Share Posted July 9, 2014 Hi, I´ve been following some of the examples posted, and from there, I created a Server and Client scripts, but I wonder if the Client can recieve data with variable lenght. For example, the server send the strings "Dog", "Elephant", 0345, etc how should I set up the $sDataRecived=TCPRecv($socket, $length) command so I don´t get something like "DogElep", or "034", etc ? Thx a lot for the help. Link to comment Share on other sites More sharing options...
JScript Posted July 9, 2014 Share Posted July 9, 2014 I'll give you an alternative: First, send the buffer size, then the data! JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
ruelas05 Posted July 9, 2014 Author Share Posted July 9, 2014 Thx for the option JS, I can certainly get the data length first, in a variable called $iDL, but, I got an error when trying to read the data using $sDataRecived=TCPRecv($socket, $iDL) however, if I use a MsgBox to display $iDL before the $sDataRecived... I can get the data with no issues other way, I continue to get an error (error code: -1) so,,, how do I use a variable to set the "max lenght" paremeter in the TCPRecv command? thx again. Link to comment Share on other sites More sharing options...
ruelas05 Posted July 9, 2014 Author Share Posted July 9, 2014 I tried this: $sDataRecived=TCPRecv($socket, Number($iDL)) and it works most of the times, but not always, I still some times get the error code : -1 I´ll continue trying to get a stable communication channel... any ideas / help are welcome. Thx!! 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