Network Basics and Socket overview
Computer Network means a group of computers connect with each other via some medium and transfer the data between them.
Java supports Network Programming so we can make such program in which the machines connected in network will send and receive data from other machine in the network by programming.
The package java.net provides support for sockets programming
A Protocol is a standard pattern of exchanging information. The java.net package provides support for the two common network protocols:
TCP:TCP stands for Transmission Control Protocol, which allows for reliable communication between two applications. TCP is typically used over the Internet Protocol, which is referred to as TCP/IP.
UDP: UDP stands for User Datagram Protocol, a connection-less protocol that allows for packets of data to be transmitted between applications.
A socket is one end-point of a two-way communication link between two programs running on the network.
Socket classes are used to represent the connection between a client program and a server program.
The java.net.Socket class represents a socket, and the java.net.ServerSocket class provides a mechanism for the server program to listen for clients and establish connections with them.
The package java.net provides support for sockets programming (and more).
Typically you import everything defined in this package with: