aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes Networking performance questions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "Networking performance questions" Watch "Networking performance questions" New topic
Author

Networking performance questions

Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
Hi,

I have written an application that transfers data across a network using Socket, getInputStream(), getOutputStream(). I have some concerns about how to optimize for performance.

Currently I am writing one byte at a time to the OutputStream. I am wondering if this results in a separate TCP packet being sent for each byte, which would obviously be very inefficient. Or does it buffer the data into a packet before sending?

If I need to wrap my OutputStream, what is the recommended way to do it?

Thanks
geoffrey


Sun Certified Programmer for the Java 2 Platform
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8259

Geoffrey Falk wrote:. I am wondering if this results in a separate TCP packet being sent for each byte,


No. The OS is going to do some caching of its own. Of course, it is always better to make fewer API calls if possible. The online book Java Platform Performance has several techniques to optimize IO.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Networking performance questions
 
Similar Threads
LAN help
Urgently Help/Guidance Required
UDP Packet on socket Receive
Sending file over network through sockets using serializable object
Problem while transferrinf file over network thru serializable object