3. Java Networking is a concept of connecting two or more computing devices
together so that we can share resources.
Java socket programming provides facility to share data between different
computing devices.
4. A Socket is one endpoint of a two-way Connection link between two programs
running on the network.
The socket is bound to a port number so that TCP layer can identify the
application that data is destined to be sent.
Port number are 16 bit unsigned binary no.
5. TCP: Transmission Control Protocol provides reliable communication between the
sender and receiver. TCP is used along with the Internet Protocol referred as TCP/IP.
java.net.Socket – For Client implementation
Java.net.Server.Socket – For Server implementation
UDP: User Datagram Protocol provides a connection-less protocol service by allowing
packet of data to be transferred along two or more nodes
6. Public Input Stream getInputStream() Return the input stream attached with this
socket.
Public Output Stream getOutputStream() Return the output stream attached with this
socket.
Public Synchronized void close() Closes this Socket.
Public Socket accept() Return the socket and establish a connection
between client & server.
Public Synchronized void close() Closes the server socket.
7. Clients and servers exchange messages in a request response it’s a messaging
pattern. The client sends a request, and the server returns a response. This
exchange of messages is an example of inter-process communication.
To communicate, the computers must have a common language, and they must
follow rules so that both the client and the server know what to expect. The
language and rules of communication are defined in a communication.
All client-server protocols operate in the application layer. The application-layer
protocol defines the basic patterns of the dialogue.
8. When a bank customer accesses online banking services with a web browser (the
client), the client initiates a request to the bank's web server.
The customer’s login credentials may be stored in a database, and the web server
accesses the database server as a client.
An application server interprets the returned data and provides the output to the
web server.
Finally, the web server returns the result to the client’s display.
In each step of this sequence of client–server message exchanges, a computer
processes a request and returns data. This is the request-response messaging
pattern.
This example illustrates a design pattern applicable to the client–server model:
separation of concerns.
9. ADVANTAGES & DISADVANTAGES OF THE
CLIENT-SERVER MODEL
Advantage Disadvantage
the client-server model is centralized
architecture helps make it easier to protect
data with access controls that are enforced
by security policies.
The client-server model is that if too many
clients simultaneously request data from the
server, it may get overloaded.
it doesn't matter if the clients and the server
are built on the same operating system
because data is transferred through client-
server protocols that are platform-agnostic.
In addition to causing network congestion,
too many requests may result in a denial of
service.