














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















Server
Server socket on port 8000 SeverSocket server = new ServerSocket(8000); A client socket Socket socket = server.accept()
Client
Client socket Socket socket = new Socket(host, serverPort#)
I/O Stream
radius
Server Client
compute area
area
Server Code Run
Client Code
Note: Run Server first, then Client. Press Ctrl+C to close the window.
Run
Due to security constraints, applets can only
connect to the host from which they were loaded.
Therefore, the HTML file must be located on the
machine on which the server is running.
Run
Click Run. Type java RegistrationServer and press Enter. Alt+Tab back to this window and click Run again. Type appletviewer registrationClient.html in the second DOS window. Display the Applet Viewer on top of the server window, and enter student information. To end the server session, press Ctrl+C. (Note: This program cannot be run from the CD.)
Server Code Client Code
The following statement creates a Java URL object:
try {
URL location = new URL("http://www.sun.com");
} catch(MalformedURLException e) {
}
ViewingWebPages
If necessary, click the Run button to access the DOS prompt. Using a JDK 1.2-enabled Web browser. This applet cannot run using the Applet Viewer utility.
Run
Web Server
Local file
Internet^ Web Browser^ Applet reads the file
Application reads the file
The following figure shows the process by which an applet reads the files on the Web server:
server:
JEditorPane can be used to display HTML files.
WebBrowse
Run Applet Viewer
Server
Player 2
... Session N
Player 1
Session 1
... Player 1 Player 2