java - Is it safe to use multiple OutputStream for the same Socket? -


Is this code safe to use? I am used to create a PrintWriter or a reader per socket, but now I am in a situation where I have to pass the bases in this manner, so I am asking that I Need to stop after a worry or worry about problems of memory or harm the socket in the long run?

  say hello to the public static zero (socket socket) {{PrintWriter out = new print Writer (socket.getOutputStream ()); Out.println ("hello!"); Out.flush (); } Hold (Exception e) {}}    

No, it is not safe Are religious, and until all the streams / writers are not indexed, they can not interfere when they automatically flush themselves, it is quite difficult to complete normally. It happens that it is not easy to use multiple streams in the first place, you have a single pair Mr. currents must build (input and output) and should use them to the socket life.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -