June 2002
Intermediate to advanced
504 pages
10h 10m
English
In the GCF, connections are established using the class Connector. By passing a URL describing the protocol to the open method of the Connector class, a connection is established. For example, the following line opens a Hypertext Transfer Protocol (HTTP) connection to the address http://java.sun.com:
try {
Connection connection = Connector.open ("http://java.sun.com");
}
catch (IOException e) {
// an error occurred while opening the connection.
}
In the case of an error, an IOException is thrown. Most of the GCF methods can throw an IOException in order to report I/O errors to the application.
If the connection is established successfully, an instance of a class implementing the Connection interfaces ...
Read now
Unlock full access