1.Introduction
Because of Increasing Demand for Internet Applications, Object-oriented Java technologies—Sockets, threads, RMI, clustering, Web services—have emerged as leading solutions for creating portable, efficient, and maintainable large and complex Internet applications.
2.Networking Basics
-
Physical/Link Layer
Functionalities for transmission of signals representing a stream of data from one computer to another -
Internet/Network Layer
IP (Internet Protocols) – a packet of data to be addressed to a remote computer and delivered -
Transport Layer
Functionalities for delivering data packets to a specific process on a remote computer.
– TCP (Transmission Control Protocol):
TCP (Transmission Control Protocol) is a connection-oriented communication protocol that provides a reliable flow of data between two computers. like HTTP, FTP, Telnet.– UDP (User Datagram Protocol):
UDP (User Datagram Protocol) is a connectionless communication protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival or order of arrival. like Ping, Live streaming (event/sports broadcasting).– Programming Interface: Sockets
-
Applications Layer
Message exchange between standard or user applications:
HTTP, FTP, Telnet, Skype,…
3.Understanding Ports and Sockets
3.1 Ports
The TCP and UDP protocols use ports to map incoming data to a particular process running on a computer.
- Port is represented by a positive (16-bit) integer value
- Some ports have been reserved to support common/well known services:
– ftp 21/tcp
– telnet 23/tcp
– smtp 25/tcp
– login 513/tcp - User-level processes/services generally use port number value >= 1024
3.2 Sockets
concept
- Sockets provide an interface for programming networks at the transport layer
- Network communication using Sockets is very much similar to performing file I/O
– In fact, socket handle is treated like file handle.