Writing Your Own Client and Server
Applets are restricted from connecting to just any Web server. They can only connect back to the server from which they were downloaded. If you want to give an applet access to the rest of the Internet, you'll need to place a server on the same machine that hosts the applet. You can use a commercial server such as a File Transfer Protocol (FTP) server, or you can write your own special-purpose server.
When you write a server, you write a program that opens a socket (typically on a well-known port number) and waits for some client to connect. The client calls in from some unused port number (called an ephemeral port). As soon as the client and the server connect, it's common for the server to propose that the ...
Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.