java - Does closing the socket close the stream? -


  1. i working in legacy java application, in many files, socket , streams used, sockets getting closed not streams, necessary close streams before closing socket. because getting "too many open files error", error because of not closing streams.....

  2. closing socket automatically close streams also?

from socket javadoc:

closing socket close socket's inputstream , outputstream.

so speaking, closing socket should enough close both streams created.

your "too many open files error" caused else.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -