Chapter 2. Networking in Java
We saw in Chapter 1 how the socket and stream
classes in the java.net and
java.io packages could be used to do basic
networking between agents. In this chapter we take a more detailed
look at the networking support in Java, as the foundation for
distributed systems. The topics we’ll cover include:
Sockets for low-level network connections
Streams for formatted data and messaging protocols
URL,URLConnection, andContentHandlerclassesThe
ClassLoaderas an object distribution scheme
We’ll look at these topics in increasing pecking order from the
networking perspective. Sockets first, since they are the most
primitive communication object in the Java API; then streams, which
let you impose some order on the data flowing over these sockets;
next, the classes associated with the HTTP protocol, namely, the
URL, URLConnection, and
ContentHandler classes; finally, the
ClassLoader, which, when coupled with the
others, offers the ability to transmit actual Java classes over the
wire.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access