Networking with Java for Computer Science and MCA students

What is port?

  • It is a logical connection place and uses the internet protocol TCP/IP the way a client program specifies a particular server program on a computer in a network.
  • The higher level applications use the TCP/IP such as the web protocol, hypertext transfer protocol that have the ports with preassigned numbers. They are well known as well known ports.
  • The processes are given port numbers dynamically for each connection.
  • Porting means to move an application program from an operating system environment in which it was developed to another operating system environment so it can be run there.
  • Porting implies some work, but not nearly as much as redeveloping the program in the new environment.
  • When the Java ES installer requests a port number, the installer performs a runtime check on the ports in use and displays an appropriate default value. If the default port number is being used by another component or by another instance of the same product component, the installer presents an alternative value.
The following table provides the various default ports:

Product ComponentPortPurpose
Access Manager58946UNIX authentication helper
58943Secure ID authentication helper (Solaris SPARC only)
Application Server8080Standard instance HTTP port
3700Standard IIOP port
4849Administration Server HTTPS port
7676Standard Message Queue port
8686JMX port
8181Standard instance HTTPS port
Common agent container11162JMX port (TCP)
11161SNMP Adaptor port (UDP)
11162SNMP Adaptor port for traps (UDP)
11163Commandstream Adaptor port (TCP)
11164RMI Connector port (TCP)
Common agent container for Sun Cluster and Sun Cluster Geographic Edition10162JMX port (TCP)
10161SNMP Adaptor port (UDP)
10162SNMP Adaptor port for traps (UDP)
10163Commandstream Adaptor port (TCP)
10164RMI Connector port (TCP)
Directory Proxy Server389Standard LDAP listener
636LDAPS over SSL
Directory Server389Standard LDAP listener
636LDAPS over SSL
Directory Server Control Center6789Sun Java Web Console listener
HADB1862Management Agent Port (JMX)
15200Default Portbase
Java DB1527Also for Apache Derby
Message Queue80Standard HTTP port
7676Port Mapper
7674HTTPS Tunneling Servlet Port
7675HTTP Tunneling Servlet Port
Monitoring Console6789Accessed through Sun Java Web Console
8765Job Factories port for Master Agent Web Services Adaptor
11161SNMP port for Monitoring Framework
11164RMI port for Monitoring Framework
54320Multicast port for Monitoring Framework discovery protocol
Portal Server Secure Remote Access8080Standard HTTP Port
443HTTP over SSL
10443Rewriter Proxy port
10555Netlet Proxy port
Service Registry6480HTTP port
6443HTTPS port
6484Message Queue Port
6485IIOP port
6486IIOP SSL port
6487IIOP Mutual Authentication port
6488JMX port
6489Application Server domain administration port
Sun Cluster Software23Use Telnet port 23 for Sun Fire 15000 system controller
161Simple Network Management Protocol (SNMP) agent communication port
3000SunPlex Installer port
5000-5010Console access port (Add 5000 to the physical port number.)
6789SunPlex Manager accessed through Sun Java Web Console
8059-8062Cluster private interconnect
Web Proxy Server8888Administration Port
8080Proxy Instance Port
Web Server8800Admin HTTP port
8989Admin SSL port. For Admin Server, SSL port is required, HTTP port is optional.
80Instance HTTP port

What is URL?

  • URL is known as Uniform Resource Locator. It is a standard way of locating resources on the Internet.
  • Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web. A resource can be something as simple as a file or a directory, or it can be a reference to a more complicated object, such as a query to a database or to a search engine.
Example: www.hotmail.com

Some of the basic parts of a URL are as follows:
  • Protocol name: http/file/mailto etc.
  • Host: www.hotmail.com
  • Port: It is an optional attribute that is specified after the host name. e.g. www.hotmail.com:80
  • File: It is the name of the file that is to be accessed. e.g. www.hotmail.com/index.html
  • Reference: It is the name of the named reference within the page (i.e. cs) e.g. www.hotmail.com/index.html#cs
Example of the URL class:

Public URL (String res) throws MalformedURLException

Types of URL:

1. File URL
  • Lets assume there is a document called "foobar.txt"; and itt sits on an anonymous ftp server called "ftp.careerride.com" in directory "/pub/files". The URL for this file is then:
  • file://ftp.careerride.com/pub/files/foobar.txt
  • The toplevel directory of this FTP server will be:
  • file://ftp.careerride.com/
  • The "pub" directory of this FTP server will be:
  • file://ftp.careerride.com/pub
2. Gopher URL
  • They are a little more complicated than file URLs, as they are a little tricker to deal with than FTP servers. To visit a particular gopher server, use this URL:
  • gopher://gopher.careerride.com/
  • There are some gopher servers may reside on unusual network ports on their host machines. (The default gopher port number is 70.) If you know that the gopher server on the machine "gopher.banzai.edu" is on port 1234 instead of port 70, then the corresponding URL would be:
  • gopher://gopher.careerride.edu:1234/
3. News URL
  • For pointing to a Usenet newsgroup, the URL is:
  • news : rec.java
  • Currently, the network clients like Mosaic don't allow to specify a news server like it is normally expected it is being planned but in the meantime the local news server is to be specified via some other method.
4. HTTP URL
  • HTTP stands for HyperText Transport Protocol. They are commonly used for serving hypertext documents, as HTTP is an extremely low-overhead protocol that capitalizes on the fact that navigation information can be embedded in such documents directly and thus the protocol itself doesn't have to support full navigation features like the FTP and Gopher protocols do. They can be any normal URL that we use everyday.
5. Partial URL
  • Once a document is viewed located somewhere on the network, the partial URL can be used to point to another file in the same directory, on the same machine, being served by the same server software. For example, if another file exists in that same directory called "anotherfile.html", then anotherfile.html is a valid partial URL at that point. It provides an easy way to build sets of hypertext documents.