- A network is a collection of computers and other devices that can send data to and receive data from one another.
- Each machine on a network is called a node. Nodes that are functional computers are called hosts.
- All modern computer networks are packet-switched networks: data traveling on the network is broken into chunks called packets.
- A Protocol is a precise set of rules defining how computers communicate: the format of addresses, how data is split into packets etc..
Layers of Network
When a browser sends a request to a web server to retrieve the page, the browser is actually talking to the transport layer on the local machine. The Transport Layer breaks the request into TCP segments, adds some sequence numbers then passes the data to Internet Layer. The Internet Layer fragments the segments into IP datagrams and passes them to host - to - network layer.
Once all the process is done in the other way around, and the Transport Layer in the Server has received enough contiguous, sequential datagrams, it reassembles them and writes them onto a stream read by the web server running in the server application layer.
PortsEach computer with an IP address has several thousand logical ports which are purely abstractions in the computer's memory and do not represent anything physical like USB port.
When data is sent to a web server on a particular machine at a particular IP address, it is also sent to a particular port.
For example, HTTP, the underlying protocol of the Web, commonly uses port 80. It is said that a web server listens on a port for incoming connections.
Port numbers between 1 and 1023 are reserved for well-known services like finger, FTP, HTTP and IMAP.
The Client Server Model
Java does not have explicit peer-to-peer communication in its core networking API. However, applications can easily offer peer-to-peer communications in several ways, most commonly by acting as both a server and a client.