the usual data handling that i know in sockets is by using an input
stream and output stream for reading and writing data, respectively:
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(),
true);
BufferedReader in = new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));
1. how do i read data byte-per-byte from a socket?
2. how do i write data byte-per-byte to a socket?
thanks.
Knute Johnson - 17 Feb 2006 06:18 GMT
> the usual data handling that i know in sockets is by using an input
> stream and output stream for reading and writing data, respectively:
[quoted text clipped - 8 lines]
>
> thanks.
Just use the InputStream and OutputStream that you get from the socket.
Actually it is interesting that you asked this question this way. There
are a lot of posts here periodically where people are having trouble
getting their data moved around. It is almost always caused by using
some extension of FilterOutputStream/InputStream and available. Use
InputStream/OutputStream for binary data and buffer it yourself or add a
BufferedInputStream/OutputStream. For text or string data use
BufferedReader/Writer. Those will cover 99% of all the I/O you need to do.

Signature
Knute Johnson
email s/nospam/knute/