> From: David kerber [mailto:dcker...@verizon.net]
> Subject: Re: Peformance on socket reads

> What method would you suggest?  Create the byte array long enough to
> handle any possible input and then read without specifying the length?

No, keep allocating the byte array based on the content-length (plus perhaps a 
bit more for insurance); but if you discover that there is more input than 
that, get a larger one and do System.arraycopy() to save what you already 
processed.  That shouldn't happen very often, so it's not a performance issue.  
If it does happen often, your clients are broken and need to be fixed.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

Reply via email to