We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
net library (Read 484 times)
net library
Feb 13th, 2010, 1:34pm
 
Hello everyone,
It is my first message here, although I have been using Processing for quite some time now.
Recently, I have been developing two sketches with network functionality and using the native net library but I have been running on a problem that I have somehow fixed with a hax.

My problem is that when Server/Client exchange messages with Strings as input many times the Client.readString() and Server.available() methods return concatenated strings of the original String leaving the Server/Client. What is happening (I assume), is that the String trafficked over the network is often fragmented and when the above commands are used only the last part (usually out of 2) is being stored in a String variable.

My solution so far is to use a buffer variable to store all messages check if that is a full String message or a concatenated one.

Has anyone else encountered the same problem? Is there are good advice?
Page Index Toggle Pages: 1