logo

Client Server Programming - Desklib

   

Added on  2022-08-10

9 Pages1289 Words365 Views
Running head: CLIENT SERVER PROGRAMMING
CLIENT SERVER PROGRAMMING
Name of the Student
Name of the University
Author Note

CLIENT SERVER PROGRAMMING1
Client-Server Programming
Client-Server programming is used to established connection between clients and
communicate with each other. In this, the Java programming language is used to implement client-
server programming using Socket programming. Socket programming provided the ability to create a
server and established connecting between server and client to interact with each other. Basically,
socket programming offers a way to connect nodes on a network to communicate with each other.
In this program, java socket programming is used for establishing a connection between
client and server and RSA algorithm is used for encryption and decryption of the message sends by
the client for transmitting message securely. Java socket programming helps to connect with the
server if both server and client runs on the same machine or in the different machine it used for
connecting server and client.
In this java program, different java class is used to perform client-server communication. In
this program, four different class is used, and every class performs a different operation. The first
class of this program is Server.java which is used to create a server using the Server socket class with
the appropriate port number. Server.java class plays a very important role in client-server
communication without this class; it is not possible to perform client-server communication.
This java program is used to create client-server programming where client and server both
interact with each other privately because the message sends and received by the client and server is
encrypted using RSA algorithm so no one can read the message without key. In the RSA algorithm, a
public key is used for decryption, and the private key is used for encryption. This encryption and
decryption method helps to sends and receive messages securely.
The second class called Client.java is used for creating the client, and every client has to
connect with the server by providing appropriate hostname and port number for communicating with

CLIENT SERVER PROGRAMMING2
the server. Another class which is used in this program is RSA.java which is used to performs
operations like encryption, decryption, key generation and SHA-256 hash generation for user id.
The fourth java class called message.java is used to store all the necessary information of the
message. In this class, all the encrypted message, keys along with SHA256 hash is stored. All the
classes are described below with some codes.
Server.java
Server.java class is a very important class of this client-server program because in this class a
server is created. For creating server Socket API’s socket class is used. For creating server
application first create an instance of the ServerSocket class.
ServerSocket ss = new ServerSocket(4567);
The above line of code is used to create an instance of ServerSocket with the appropriate port
number. After the above operation, Server.java class is ready to accept client request to connect with
the server for communicating with each other.
After the instance of server-socket is created successfully, then accept method of the socket is
waits for the client's request for connecting to communicate with the server.
Socket s = ss.accept();
The above line of the Server class is used to accept client request to connect with the server at
this point of time server connection is established, and the server waits for the client.
Client.java
Client.java class is used to create client application, and for that, it is necessary to create an
instance of Socket class and pass the hostname of the server along with a port number. In this
program, localhost is used for hostname because both server and client is going to run on the same

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Client Server Programming Using RSA
|9
|1136
|384

Client and Server Application | Report
|16
|1570
|21

Program Description | Document
|15
|1603
|24

Client Server System for Socket Programming | Desklib
|18
|1451
|253

TLS/SSL Handshake with RSA and DHE - Desklib
|16
|2305
|399

Hybrid Encryption
|4
|798
|8