I'm writing to a socket using a buffered stream. When control returns after write() is invoked, has the data been sent over the network or just copied to the buffer? How does the user get notification of a network failure if the data is just put into the buffer?

Maxim Senin

The data is sent only when the buffer is full or flush() is invoked on the buffered stream. If the network fails (e.g. the remote host closes the socket), an IOException will be thrown the next time you perform an operation on the socket.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact