Overview

In this homework, you will use socket programming to implement dual TCP/UDP sessions for a client to receive messages from a server. The server program will listen to a port for TCP connections. The client program will connect to the server and listen to a UDP port. The server will then deliver 100 messages through both TCP and UDP sockets concurrently. Initially, half blocks are supposed to be transferred via TCP and the other half to be transferred via UDP. However, if any packet fails to be delivered via UDP, the server should retransmit it using the TCP connection instead. see image.

Homework Task

You need to develop two programs: (1) HW2Server.java and (2) HW2Client.java.

HW2Server.java

1.The server program should be launched as
java HW2Server portNumber
where portNumber specifies the port for TCP connections.

2.The server program has to support multiple concurrent clients.

HW2Client.java

1.The client program should be launched as
java HW2Client server_host tcp_port udp_port
where the first two argument specify the host and TCP port of the server program, and the third argument is the UDP port the client listens to.

2.Next, the client will start to receive data from the server through both TCP and UDP sockets concurrently.

The messages can be in arbitrary format, e.g.,

This is message 1.
This is message 2.
… …
This is message 100.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.