February 2014
Beginner
1248 pages
62h 25m
English
Step 3 is to get the OutputStream and InputStream objects that enable the server to communicate with the client by sending and receiving bytes. The server sends information to the client via an OutputStream and receives information from the client via an InputStream. The server invokes method getOutputStream on the Socket to get a reference to the Socket’s OutputStream and invokes method getInputStream on the Socket to get a reference to the Socket’s InputStream.
The stream objects can be used to send or receive individual bytes or sequences of bytes with the OutputStream’s method write and the InputStream’s method read, respectively. Often it’s useful to send or receive values of primitive types (e.g.,
Read now
Unlock full access