Sign in to follow this  
Followers 0
ruelas05

TCPRecv for variable data lenght

4 posts in this topic

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.

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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!! 

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  
Followers 0