tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Performance on socket reads
Date Fri, 15 May 2009 18:50:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 5/15/2009 12:22 PM, David kerber wrote:
> But the code works; it just seems to be a little slow.

Gotcha. How slow are we talking, here? I'm not sure whether the
underlying InputStream, here, is buffering, but you could try:

iStream = new BufferedInputStream(req.getInputStream());

... to see if that improves things at all.

> At this point, [the data is] still encrypted, and a string may not properly
> handle some of the bytes.

Oh, right. I forgot you were sending encrypted data.

>> I think you may have better luck reading until there is no more input,
>
> What method would you suggest?  Create the byte array long enough to
> handle any possible input and then read without specifying the length?

Something like that. After thinking a bit about it, specifying more
bytes to read than are available either blocks (waiting for more data
that will come) or returns after reading fewer bytes (because the stream
is closed and there's no more to read). Your code should be pretty good
as-is.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkoNuYUACgkQ9CaO5/Lv0PAOwQCgxCEVgtRLYG0V1mFC421dC318
8wkAoLQ1WwoQULSMcTiyEFGHQaGYTBPL
=ADDW
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message