I'm looking for an efficient solution to receive and process asynchronous messages (of varying size) from a socket connection to a server. It is a good amount of bandwidth coming over (maybe 250 kB/s steady state, and can have short bursts up to 1 MB/s). Currently I'm using a DataInputStream, but during busy moments I get disconnected (the server disconnects a client if the queue backlog grows too large).
Can anyone confirm if a BufferedInputStream may work better? I've read that it will retrieve chunks of data at a time, rather than byte by byte, so there are fewer OS calls.
Thanks!