This chapter.explores the package, which provides support of networking. Its creators have called Java “programming for the Internet.” While . true, there is actually very little in Java, the programming language, that makes it any more appropriate for writing networked programs than, say, C++ or FORTRAN. ‘What makes Java a good language for networking arc the classes defined in the java.net package. These networking classes encapsulate the “socket” paradigm pioneered in/the Berkeley Software Distribution (BSD) from the University of California at Berkeley. No discussion of Internet networking libraries would be
Ken Thompson and Dennis Itchier developed UNIX in concert with the C language at Bell Telephone Laboratories, Murray Hill, New Jersey, in 1969.For many years, the development of UNIX remained in Bell Labs and in a few universities and research facilities that had the DEC machines it was designed to be run on. In 1978, was leading a project at Cal Berkeley to add m’my new features to UNIX, such as virtual memory and full-screen display capabilities. By early 1984,just as Bill was leaving to found Sun Micro systems, he shipped , commonly known as . came with a fast file system, reliable signals, inter process communication, and, most important, networking. The networking support first eventually became the defector standard for the Internet. Berkeley’s implementation of remains the primary standard for communications within the Internet. The socket paradigm for inter process and network communication has also been widely adopted outside of Berkeley. Even Windows and the Macintosh started talking “Berkeley sockets” in the late .
A network socket is a lot like an electrical socket. Various plugs around the network have a standard way of delivering their payload.Anything that understands the standard protocol can “plug in” to the socket and communicate. With electrical sockets, it doesn’t matter if you plug in a lamp or a toaster; as long as they are expecting ~OHz, l1S-volt electricity, the devices will work: Think how your electric bill is created. There is a meter somewhere between your house and the rest of the network. For each kilowatt of power that goeg through that meter, you are billed. The bill comes to your “address.” So even though the electricity flows freely around the power grid, all of the sockets in your house have a particular address. The same idea applies to network sockets, except we talk about TCPlIP packets and IP addresses rather than electrons and street addresses. Internet Protocol (IP) is a low-level routing protocol that breaks data into small packets and sends them to an address across a network, which docs not guarantee to deliver said packets to the
destination. Transmission Control Protocol (TCP) is a higher-level protocol that manages to robustly string together these packets, sorting and re transmitting them as necessary to reliably transmit your data. A third protocol, User Data gram Protocol (LlDP), sits next to Tep and can be used directly to support fast, concoctions, unreliable transport of packets.
You often hear the term client/server mentioned in the context of neworking.ll seems complicated when you read about it in corporate marketing statements, but it is actually quite simple. A saver is anything that has some resource that can be shared. There are compute servers, which provide computing power: print servers, which manage a collection of printers; disk servers, which provide networked disk space; and web servers, which store web pages, A client is simply any other entity that wants to gain access to a particular server, The interaction between client and server is like the interaction between a lamp and an electrical socket. The power grid of the house is the server, and the lamp is a power client. The server is a permanently available resource, while the client to “unplug” after it is has been served.In Berkeley sockets, the notion of a socket allows a single computer to serve many different clients at once, as well <IS serving many different types of information. This feat is managed by the introduction of a port, which is a numbered socket on a to It. server IS a owe to accept mu tip e cents connector to t ic same’ port although each session is unique: To manage multiple client connections, server process must be or have some other means of multiplexing the simultaneous 1/0.
A proxy server speaks the client side of a protocol to another server. This is often required when clients have certain restrictions on which servers they can connect to Thus, a client would connect to a proxy server, which did not have such restrictions, and the proxy server would in turn communicate for the client. A proxy server has’the additional ability to filter certain requests or cache the results of those requests for future use. A caching proxy HTTP server can help reduce the bandwidth demands on a local network’s connection to the Internet. When a popular web site is being hit by hundreds of users, a.proxy server can get the contents of the web server’s popular pages once, saving expensive inter network transfers while providing faster aces to those pages to the clients.
Later in this chapter, we will actually build a complete caching proxy HTTP server.The interesting part about this sample program is that it is both a client and a server. To serve certain pages, it must act as a client to other servers to obtain a copy’ of the requested content.
Every computer on the Internet has an address. An Internet address is a number that uniquely identifies each computer on the Net. There are 32 bits in an IF address, and we often refer to them as a sequence of four numbers between 0 and 255 separated by dots This makes them easier to remember, because they are not randomly.
assigned they are hierarchically assigned. The first few bits define which class of network, lettered A, H, C, 0, or E, the address represents. Most Internet users are on a class C network, since there are over two million networks in class C. The first byte of a class C network is between 192 and 224, with the last byte actually identifying computer among the 256 allowed on a single class C network. This shame allows for half a billion devices to live on class C networks.
assigned-they are hierarchically assigned. The first few bits define which class of network, lettered A, H, C, 0, or E, the address represents. Most Internet users are on a class C network, since there are over two million networks in class C. The first byte of a class C network is between 192 and 224, with the last byte actually identifying an individual computer among the 256 allowed on a single class C network. This scheme allows for half a billion devices to live on class C networks.