Skill-Building Exercises


Summary

A computer network is an interconnected collection of computing devices. Examples of computing devices include general purpose computers, special purpose computers, routers, switches, hubs, printers, personal digital assistants (PDAs), etc. The primary purpose of a computer network is resource sharing. A resource can be physical (i.e. a printer) or metaphysical (i.e. data).

A protocol is a specification of rules that govern the conduct of a particular activity. Entities that implement the protocol(s) for a given activity can participate in that activity. Computers participating in a computer network communicate with each other via a set of networking protocols. There are generally two types of network environments: 1) homogeneous - where all the computers are built by the same company and can talk to each other via that company’s proprietary networking protocol, or 2) heterogeneous - where the computers are built by different companies, have different operating systems, and therefore different proprietary networking protocols. In today’s heterogeneous computer network environment the protocols that power the Internet — Transmission Control Protocol (TCP) and Internet Protocol (IP) — collectively referred to as TCP/IP, have emerged as the standard network protocols through which different types of computers can talk to each other.

What makes the Internet so special? The answer — TCP/IP. When one computer communicates with another computer via the Internet the data it sends is separated into packets and transmitted a packet at a time to the designated computer. TCP/IP provides for packet routing and guaranteed packet delivery. Because of the functionality provided by the TCP/IP protocols the Internet is considered to be a robust and reliable way to transmit and receive data.

The terms server and client each have both a hardware and software aspect. The term server is often used to refer both to a piece of computing hardware on which a server application runs and to the server application itself. A good definition for a server then is any computer used to host one or more server applications as its primary job. A server running a server application is also referred to as a host. The term host extends to any computer running any application. The term client is also used to describe both hardware and software. Client hardware is any computing device that hosts an application that requires or uses the services of a server application. Client software is any application that requires or uses the services provided by a server application.

The term application distribution refers to where (i.e., on what physical computer) one or more pieces of a network application reside. Client and server applications can be deployed to the same physical computer. In this case multiple JVM instances are required to execute each client and server application. Client and server applications can be deployed to different physical computers. These computers may be in the same room or located a great distance from each other. Regardless of where the applications reside, each Java application (client or server) will require a JVM and supporting Java and third-party class libraries to execute.

Client and server applications can be logically separated into distinct functional areas called tiers. Applications logically segmented in this fashion are referred to as multi-tiered applications.

Three possible logical application tiers include: 1) the presentation tier, which is concerned with rendering the application’s user interface, 2) the mission logic tier, which is concerned with implementing mission process logic, and 3) the data persistence tier, which is concerned with the quick and reliable delivery of data to the mission logic tier.

Multi-tiered application can be physically deployed on one computer or across several computers geographically separated by great distances.

The Internet protocols facilitate the transmission and reception of data between participating client and server applications in a packet-switched network environment. The term packet-switched network means that data traveling along network pathways is divided into small, routable packages referred to as packets. If a communication link between two points on a network goes down the packets can be routed through remaining network connections to their intended destination.

The Internet protocols work together as a layered protocol stack. The layered protocol stack consists of the application layer, the transport layer, the network layer, the data link layer, and the physical layer. Each layer in the protocol stack provides a set of services to the layer above it.

The application layer represents any internet enabled application that requires the services of the transport layer. The purpose of the transport layer is to provide host-to-host, connection-oriented, data transmission service to the application layer. Two internet protocols that function at the transport layer include the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). TCP guarantees data delivery and saves you the worry. UDP is faster than TCP but unreliable.

The network layer is responsible for the routing of data traffic between internet hosts. The Internet Protocol (IP) is a connectionless service that permits the exchange of data between hosts without a prior call setup. (Hence the term connectionless.) It packages data submitted by TCP or UDP into blocks called datagrams. IP uses IP addresses and routing tables to properly route datagrams to their intended destination networks.

The data link and physical layers are the lowest layers of the networking protocol stack. The data link layer sits below the network layer and is responsible for the transmission of data across a particular communications link. The physical layer is responsible for the actual transmission of data across the physical communication lines.

Computers that participate in a TCP/IP networking environment must be running an instance of the TCP/IP protocol stack. The TCP/IP protocol stack is provided by a computer’s operating system.

The Java platform makes network programming easy with the classes provided in the java.net package. Use the ServerSocket and Socket classes when writing client-server network applications. The ServerSocket class is used in a server application to listen for incoming client connections. The client uses a Socket class to initiate connections to a server located at a particular address listening on a particular port.

When the ServerSocket detects an incoming client connection a server-side Socket object can be obtained through which the server can communicate with the client using InputStreams and OutputStreams.

The URL class simplifies network programming by letting you retrieve network resources via Uniform Resource Locators.

Java Remote Method Invocation (RMI) provides a way for programmers to access the power and flexibility of network applications while avoiding the chore of network programming. RMI allows programmers to invoke methods on remotely located objects across a network as if they were available locally. The networking details associated with making the remote method call is handled automatically by the Java RMI runtime environment.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net