Writing to Socket outputStream w/o closing it

Posted by Eyal on Stack Overflow See other posts from Stack Overflow or by Eyal
Published on 2010-05-13T11:21:07Z Indexed on 2010/05/13 11:24 UTC
Read the original article Hit count: 317

Filed under:
|
|
|
|

Hi,

I'd like to write some messages to the server. Each time, for the tramsmitting only, I'm closing the outputStream and reopen it when I have to send the next message.

os.write(msgBytes);
os.write("\r\n".getBytes());
os.flush();
os.close();

How Can I keep this Socket's OutputStream, os, open and still be able to send the message?

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about network-programming