Chapter 3. Sending and Receiving Data

Typically you use sockets because your program needs to provide information to, or use information provided by, another program. There is no magic: any programs that exchange information must agree on how that information will be encoded— represented as a sequence of bits—as well as which program sends what information when, and how the information received affects the behavior of the program. This agreement regarding the form and meaning of information exchanged over a communication channel is called a protocol;a protocolusedin implementing a particular application is an application protocol. In our echo example from the earlier chapters, the application protocol is trivial: neither the client’s nor the server’s ...

Get TCP/IP Sockets in Java, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.