If the presence of electricity can be made visible in any part
of a circuit, I see no reason why intelligence may not be
transmitted instantaneously by electricity.
What networks of railroads, highways and canals were in
another age, the networks of telecommunications,
information and computerization \u2026 are today.
gives it the flair and sizzle of multimedia. Organizations see the Internet and the Web as crucial to their information-systems strategies. Java provides a number of built-in network- ing capabilities that make it easy to develop Internet-based and Web-based applications. Not only can Java specify parallelism through multithreading, but it can enable programs to search the world for information and to collaborate with programs running on other com- puters internationally, nationally or just within an organization. Java can enable applets and applications to communicate with one another (subject to security constraints).
Networking is a massive and complex topic. Computer science and computer engi- neering students will typically take a full-semester, upper level course in computer net- working and continue with further study at the graduate level. Java provides a rich complement of networking capabilities and will likely be used as an implementation vehicle in computer networking courses. In Java How to Program, Fourth Edition, we introduce a portion of Java\u2019s networking concepts and capabilities. For more advanced net- working capabilities, refer to our book Advanced Java 2 Platform How to Program.
17.3 Reading a File on a Web Server
17.4 Establishing a Simple Server Using Stream Sockets
17.5 Establishing a Simple Client Using Stream Sockets
17.6 Client/Server Interaction with Stream Socket Connections
17.7 Connectionless Client/Server Interaction with Datagrams
17.8 Client/Server Tic-Tac-Toe Using a Multithreaded Server
17.9 Security and the Network
17.10 DeitelMessenger Chat Server and Client
17.10.1 DeitelMessengerServer and Supporting Classes
17.10.2 DeitelMessenger Client and Supporting Classes
17.11 (Optional) Discovering Design Patterns: Design Patterns Used in
Packagesj av a .i o andj a va . ne t 17.11.1 Creational Design Patterns 17.11.2 Structural Design Patterns 17.11.3 Architectural Patterns
mitted\u2014this is commonly used to transmit audio and video over the Internet. In this chapter, we show how to create and manipulate sockets and how to communicate with packets of data.
responds to the client. A common implementation of the request-response model is between World Wide Web browsers and World Wide Web servers. When a user selects a Web site to browse through a browser (the client application), a request is sent to the appro- priate Web server (the server application). The server normally responds to the client by sending an appropriate HTML Web page.
Java provides stream sockets and datagram sockets. With stream sockets, a process establishes ac onne ction to another process. While the connection is in place, data flows between the processes in continuousstre am s. Stream sockets are said to provide ac onne c-
in any particular order. In fact, packets can be lost, can be duplicated and can even arrive out of sequence. So, with UDP, significant extra programming is required on the user\u2019s part to deal with these problems (if the user chooses to do so). UDP is most appropriate for network applications that do not require the error checking and reliability of TCP. Stream sockets and the TCP protocol will be the most desirable for the vast majority of Java programmers.
The TCP protocol and its related set of protocols enable a great variety of heterogeneous computer systems (i.e., computer systems with different processors and different operating systems) to intercommunicate.
The chapter ends with a case study in which we implement a client/server chat appli- cation similar to the instant-messaging services popular on the Web today. The program incorporates many networking techniques introduced in this chapter. The program also introducesm ultica stin g, in which a server canp ublish information and clients cansub-
Use your Facebook login and see what your friends are reading and sharing.
Now bringing you back...