Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Recieve Buffer VS Buffereing the Stream  RSS feed

 
Costa Lamona
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

When you have a socket, and you want to buffer incoming or outgoing data,
should I call

Socket.setReceiveBufferSize

or wrap the InputStream int BufferedStream.

also what is the following sentence from the javadoc of Socket.setReceiveBufferSize means?
"while decreasing it can help reduce the backlog of incoming data"

what is backlog ?

Thanks
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A backlog is a list of things that need to be done.
I suppose the statement you quote indicates that too large of a receive buffer will cause a problem because the socket tries to fill the receive buffer before handing the data to the interested party (in this case the JVM Socket implementation).
Personally, I usually use buffered streams with sockets, and that has worked Good Enough. Maybe someone with experience with socket tuning can chime in.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!