Logical (not physical) connection to computer (server).
One hardware link: Many ports.
One host (physical server) can run many services (listening processes) at different addresses.
IP address = Address of a host.
IP address + port = Address of a process (service) on a host.
List of ports. 1 to 65535 (16 bit no).
List of ports
Ports set aside for some "well-known" services:
20 - ftp data
21 - ftp control (commands)
23 - telnet
25 - SMTP - standard for email transmission from node to node
53 - DNS
80 - http
110 - POP3 - retrieve email to local client
143 - IMAP - more advanced email client
443 - https (http over SSL/TLS)
554 - rtsp
989 - ftps (ftp over SSL/TLS) (data)
990 - ftps (control)
1935 - rtmp
8080 - http alternate
Full list:
- Server machine may run multiple server processes, each contactable on different port.
- Conversely, multiple clients may want to contact same port (e.g. Web server).
- Client creates socket at its end. Sends request to server (at port no). Server creates socket at its end dedicated to that client.
- One port: Many sockets to that port.
- Port scanner - look at some machines in DCU to find ports that are "open" - providing a service.
- Does this by trying to open a socket to that port.
PROGRAM
import java.net.*;
import java.io.*;
import java.io.*;
public class ports
{
public static void main (String[] args) throws IOException
{
String hostname = args[0];
Socket s = null;
InetAddress ipaddress = InetAddress.getByName(hostname);
int p=80;
s = new Socket(hostname, p);
System.out.println("A server is running on port " + p + ".");
s.close();
}
}
{
public static void main (String[] args) throws IOException
{
String hostname = args[0];
Socket s = null;
InetAddress ipaddress = InetAddress.getByName(hostname);
int p=80;
s = new Socket(hostname, p);
System.out.println("A server is running on port " + p + ".");
s.close();
}
}
OUTPUT
A server is running on port 80.
note: Search for IMAP servers. And POP3 servers:.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.