Computer Sciences

UDP Client/Server Application

The UDP Client Server Application has been designed and developed using Java. There are two applications: a client and a server. The datagram packets have been continuously received over a datagram socket. The packet received by the server from a client consists of a mobile number, pin, reason, date, and client IP address. As soon as the packet is received by the server, the information in the packet is validated according to the stored data. If the information is valid or invalid, the server sends the message back to the client. For example, if the information is valid, it sends a success message, and it sends a message telling about invalid data. The server also maintains the log file. The server collects the packets in the array, sorts them, and saves them in the log file.

Two classes implement the server application: Server.java and startServer.java. Similarly, two classes implement client applications. Client.java and startClient.java. There is another class known as writeToFile.java that is used by the server. The server used this class to update the log file after every two seconds.

The program folder includes numerous files. The files with the .java extension contain the code. To run the UDP Client/ Server application, follow the below steps:

  1. Open Command Prompt (CMD).
  2. Specify the folder location.
  3. Compile startServer.java and startClient.java files by writing javac startServer.java and javac startClient.java in CMD.
  4. Now Run both the compiled files by typing java startServer and java startClient.
  5. The server and client windows open in front of you.

  1. The client window asks the user to specify the school location. Click on the “OK” button to continue the process, or click the cancel button to end the application.

  1. After clicking the “Ok” button, the current window will close, and another client window will open. This window asks the user to enter a mobile number and pin number. It also asks to select the reason from the drop-down menu.

  1. Click on the “Ok” button to send the information to the server.
  2. The server then validates the information and sends back the validation message accordingly.

  1. The server then shows the packet sent to it in its window and maintains the log.

  1. The log is updated after every two seconds.
  2. The clear button on the server window clears the server window and log file.

Suppose the server is not responding or working. Then, there will be no communication between the client and the server. The messages will not be sent to the server. The server will be unable to validate the data. Hence, there will be no operations.

This application can be used by companies to keep a record of their employee for check-in and checkout timings.

Cite This Work

To export a reference to this article please select a referencing stye below:

SEARCH

WHY US?

Calculate Your Order




Standard price

$310

SAVE ON YOUR FIRST ORDER!

$263.5

YOU MAY ALSO LIKE

Pop-up Message