Communication over TCP with sockets is an important technique to master, as many of the most interesting application protocols in use today occur over TCP. The Java socket API provides a clear and easy mechanism by which developers are able to accept communications as a server or initiate communications as a client. By using the concepts discussed earlier involving input and output streams under Java, the transition to socket-based communication is straightforward. With the level of exception handling built into the java.net package, it's also very easy to deal with network errors that occur at runtime.
In this chapter, you have learned:
About the Transmission Control Protocol
About clients and servers
About how to write and run a simple TCP socket client, using java.net.Socket
About how to write and run a simple TCP socket server, using java.net.ServerSocket
About exception handling with sockets