[muscle] Re: Java API writes partial messages to network under some conditions

  • From: Justin Hammond <justin@xxxxxxxx>
  • To: muscle@xxxxxxxxxxxxx
  • Date: Wed, 3 Jan 2007 05:38:43 +0800

Hi Jeremy,
You mention there is a subversion repository? is it publicly available to us?

Thanks

Justin
On 03 Jan 2007, at 2:44 AM, Jeremy Friesner wrote:

Hi Lior,

Thanks for the patch, I've added it into the subversion repository. I do have one question though: What happens when one of the flattenMessage() methods is called on a blocked TCP socket (e.g. after I've unplugged the computer's ethernet cable and its outgoing TCP buffer has filled up with data?) It seems like out.write() would start returning zero, and therefore the while loop in your patch would spin forever, eating up 100% of the CPU time. How is that handled in Java? (in C++-land, I would use select() to detect when
the socket had finally cleared up... but I don't know if there is any
equivalent to select() in Java, so I always used blocking sockets there)

-Jeremy

On Tuesday 02 January 2007 08:26, Lior Okman wrote:
Hi Jeremy,


Attached is a fix for a situation where the amount of data written to
the network is smaller than the amount of available data.

This bug only occurs in situations where the socket being used is
non-blocking. If the socket is a blocking socket (the default), the
original code works OK.


Thanks,
Lior



Other related posts: