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.
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.