O'Reilly logo

Java RMI by William Grosso

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Sockets

In this chapter, we review Java’s socket classes. Sockets are an abstraction that allow two programs, usually on different machines, to communicate by sending data through streams. Strictly speaking, the socket classes (which are defined in the java.net package) are not part of RMI. However, RMI uses Java’s socket classes to handle communication between distinct processes. Thus, a basic knowledge of how sockets work is fundamental to understanding RMI. This chapter’s coverage, though far from complete, constitutes the core of what an RMI programmer needs to know.

Internet Definitions

The Internet is built out of computers that are connected by wires.[6] Each wire serves as a way to exchange information between the two computers it connects. Information is transferred in small, discrete chunks of data called datagrams.

Each datagram has a header and a data area. The header describes the datagram: where the datagram originated, what machines have handled the datagram, the type and length of the data being sent, and the intended destination of the the datagram. The data area consists of the actual information that is being sent. In almost all networking protocols, the data area is of limited size. For example, the Internet Protocol (frequently referred to as IP) restricts datagrams to 64 KB.

The Internet Protocol is also an example of what is frequently called a connectionless protocol—each datagram is sent independently, and there is no guarantee that any ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required