Networking Section Index | Page 17
The HttpURLConnection class has a setFollowRedirects() method that allows you to disable this feature. By default, it is enabled. However, if you call setFollowRedirects() with an argument of fals...more
I'm using Java sockets to exchange data with a server written in C. How can I convert my integer values to Network Byte Order so the C server can read them properly?
Because different operating systems have different integer representations, when you send integers over a socket from a C or C++ program it is important to use the functions htons(), htonl(), n...more
How do I create an SSL socket from a Java applet?
How can my application or applet programmatically use HTTPS to talk to a servlet? Can I do it with just the Java 2 SDK?
In order to use secure sockets, you need an SSL implementation. this is not provided in the Java 2 SDK. If you are running an applet, the major browsers provide support for HTTPS through the ja...more
When retrieving data over HTTP, how do I monitor server response codes? For example, if the server I am connecting to redirects (response code 3xx), how can I tell and how do I get the new host name?
The FAQ How do I download files from a URL using HTTP? shows you how to get the data from a URL; to get the headers you need to do a few more things. HTTP returns its response code in the first...more
It is often considered a bad idea to do I/O in a constructor, and all three InetAddress factory methods (getLocalHost, getByName, and getAllByName) need to perform I/O. more
You can find some interesting stuff here: http://remus.rutgers.edu/~jszabo/myjava/Ftp.html. But also a much more powerful one here: http://www.public.wit.edu/students/kojima/index.html more
No, not currently (TINI OS beta 3.0). TINI doesn't support serialization or RMI. While RMI is not explicitly required by the Jini specification, in practice many Jini services use RMI, and in pa...more
JavaSpaces is built on top of Jini. It is, to quote "JavaSpaces Principles, Patterns, and Practice", a "... shared, network-accessible repository for objects." Jini provides a framework for dist...more
The JavaSpaces technology is written in the Java programming language, and is a Jini technology service. It is a simple, fast, and unified mechanism for sharing, coordinating, and communicating di...more
While this class is completely unsupported and it may not be available on a user's runtime, you can use it when available. The following program demonstrates its usage. For some reason the closeSe...more
You can create a server on ports 1 through 65535. Port numbers less than 256 are reserved for well-known services (like HTTP on port 80) and port numbers less than 1024 require root access on UNIX...more
Applet security restrictions do not let you get this in an untrusted applet via InetAddress.getLocalHost(). However, you can get this address by creating a Socket connection back to the web server...more
The InetAddress class provides the necessary support: InetAddress localHost = InetAddress.getLocalHost(); System.out.println(localHost.getHostName()); System.out.println(localHost.getHostAddress(...more
Untrusted applets are restricted to only communicate back to the host that delivered the applet. You cannot open a connection to any other URL besides the one from which the applet came.