|Table of Contents|
by Mary Campione
The Java environment is highly regarded in part because of its suitability for writing programs that use and interact with the resources on the Internet and the World Wide Web. In fact, Java-capable browsers use this ability of the Java environment to the extreme to transport and run applets over the net.
The Custom Networking and Security trail walks you through the complexities of writing Internet-aware Java applications and applets.
Overview of Networking has two sections. The first section provides a brief overview of networking to familiarize you with terms and concepts that you will need to understand before learning how to use URLs, sockets, and datagrams. The second section describes the networking capabilities of the Java environment that you may already be using without realizing it!
Working with URLs discusses how your Java programs can use URLs to access information on the Internet. A Uniform Resource Locator (URL) is an address of a resource on the Internet. Your Java programs can use URLs to connect to and retrieve information over the network. This lesson provides a more complete definition of URL, shows you how to create and parse URLs, how to open a connection to a URL, and how to read from and write to those connections.
All About Sockets explains how you can use sockets so that your programs can communicate with other programs on the network. A socket is one end of a two-way communication link between two programs running on the network. This lesson first shows you how to read from and write to a socket from a client program communciating with a standard server program--the echo server. Also, this lesson walks you through the details of a complete client/server example showing you how to implement both the client and the server side of a client/server pair.
All About Datagrams shows you how to use datagrams to broadcast messages over the network. The lesson on sockets focuses on "perfect" communication links between applications running on the network. Perfect communication links guarantee the arrival of all packets in the order they were sent. While necessary for some applications, perfect links are overkill for others. These applications use datagrams instead. The delivery of datagrams is not guaranteed nor is the order in which they are delivered. This lesson takes you step-by-step through a client/server example that uses datagrams to communicate.
Providing Your Own Security Manager describes how you can build and install your own security manager for your Java applications. See our new trail, Java Security 1.1, for information about the new 1.1 security APIs.
Security consideration: Note that communication over the network are subject to approval by the current security manager. The example programs contained in the lessons covering URLs, sockets, and datagrams in this trail are stand alone applications, which by default have no security manager. If you convert these applications to applets they might be unable to communicate over the network depending on the browser or viewer they are running in. See Understanding Applet Capabilities and Restrictionsfor information about the security restrictions placed on applets.
|Table of Contents|