Question: This must be in java code There are two pieces of code you have to implement in two different files a client and a server.
This must be in java code
There are two pieces of code you have to implement in two different files a client and a server. Below is the protocol specification which will give you the details you need to implement these two programs. Also, we are giving you the packet format, which specifies the content of the messages the client and server will exchange. Your implementation must work correctly even when the client and server run on architectures with different endian formats. Protocol Specification: a. The client sends a JOIN_REQ packet to initiate communication with the server. b. The server responds with a PASS_REQ packet, which is a password request to the user. c. The client will send a PASS_RESP packet to the server which includes the password. d. The server will verify the password and in case the password is correct, the server will send a PASS_ACCEPT packet to the client. e. In case the password is incorrect, the server sends a PASS_REQ packet again to the client. The PASS_REQ packet will be transmitted at most three times. After the third times, the server sends a REJECT message to the client. The client closes the session, and the server exists as well. f. Once the server transmits the PASS_ACCEPT packet to the client, the server begins transmitting the file using DATA packets. The file is broken into several segments (depending on the size of the file), and each segment is transmitted using a DATA packet. g. When the server completes sending the file, it will transmit a TERMINATE packet which marks the end of the file download. Included in this packet, there is a file digest (SHA1 digest) that the client will use to verify the integrity of the received file.
Output messages: You must print the screen the messages OK or ABORT depending on whether your application finishes correctly or terminate unexpectedly. Note that this information must be printed by both the client and the server programs. a. Print the message OK in case your application finishes correctly. This is the case when the server is able to completely send the file to the client and the digest sent by the server matches the digest of the file received by the client. b. Print the message ABORT in case an error occurs. Two examples of erroneous situations are: (i) The digest of the file the client receives differs from the digest sent by the server; (ii) The client or server receives an unexpected packet.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
