[Solved] CS3700-001: Computer Networks HW #4: Simplified SMTP on TCP

$25

File Name: CS3700_001__Computer_Networks_HW__4__Simplified_SMTP_on_TCP.zip
File Size: 555.78 KB

SKU: [Solved] CS3700-001: Computer Networks HW #4: Simplified SMTP on TCP Category: Tag:
5/5 - (1 vote)

An option of peer programming: You may choose to work on this assignment individually or in a team of two students. If you choose to work in a team of two students, you must 1) add both team members first and last names as the comments on Blackboard when submitting the .java files (both team members are required to submit the same .java files on Blackboard), and 2) put a team.txt file including both team members names under your HW4/ on cs3700a (both team members are required to complete Task II under both home directories on cs3700a). For grading, I will randomly pick the submission in one of the two home directories of the team members on cs3700a and cs3700b, and then give both team members the same grade. If the team information is missing on Blackboard or cs3700a, two or more submissions with similar source codes with just variable name/comment changes will be considered to be a violation of the Integrity described in the course policies and both or all will be graded as 0.

Grading: Your programs will be graded via testing and points are associated with how much task it can complete. A program that cannot be compiled or crashes while running will receive up to 5% of the total points. A submission of .java files that are similar to any online Java program with only variable name changes will receive 0% of the total points.

Programming in Java is highly recommended, since all requirements in this assignment are guaranteed to be supported in Java. If you choose to use any other language such as Python or C/C++, it is YOUR responsibility, before the cutoff deadline, to (2) set up the compiling and running environment on cs3700a and cs3700b, (2) make sure that I can run/test your programs in your home directory on cs3700a and cs3700b, and (3) provide a README file under HW4/ on cs3700a to include the commands that I need to use.

Part I (85%): Write a SMTP client program and a SMTP server program to implement the following simplified SMTP protocol based on TCP service. Please make sure your program supports multiple clients. You must use the port assigned to you and you may hard code it in both client and server programs.

  • Telnet <your servers ip address> <port> can be used to test your SMTP server program first (especially those 503 responses), then your SMTP client can be tested using your SMTP server program.
  • SMTP Client Program (NOT a TELNET client!!!):
    1. Display a message to ask the user to input the Host Name (or ip-address) of your SMTP server.
    2. Buildup the TCP connection to your SMTP server with the Host Name input by User at the given port. Catch the exception, terminate the program, and display error messages on the standard output if any. Wait for, read, and display the 220 response from the SMTP server.
    3. Display prompt messages on the standard output to ask the user to input senders email address, receivers email address, subject, and email contents, respectively. Since there may be multiple lines in email contents, the prompt message displayed by your Client program MUST prompt the ending signature pattern like . on a line by itself.
    4. Use the user inputs collected above in Step 3 for the following 3-phase data transfer procedure (see step 3 on server side). In each of the following steps a. through e., display the RTT (round-trip-time) of each conversation in millisecond (e.g., RTT = 212.08 ms).
      1. Send the HELO <senders mail server domain name> command (e.g., HELO xyz.com) to the SMTP server program, wait for servers response and display it on the standard output.
      2. Send the MAIL FROM: <senders email address> command to SMTP server, wait for SMTP servers response and display it on the standard output.
      3. Send the RCPT TO: <receivers email address> command to the SMTP server program, wait for SMTP servers response and display it on the standard output.
      4. Send the DATA command to the SMTP server program, wait for SMTP servers response and display it on the standard output.
      5. Send the Mail message to the SMTP server. The format of this Mail message MUST follow the format detailed on the slide titled Mail message format. Wait for SMTP servers response and display it on the standard output.
    5. Display a prompt message to ask the User whether to continue. If yes, repeat steps 3 through 5. Otherwise, send a QUIT command to the SMTP server, display SMTP Servers response, close TCP connection, and terminate the Client program.
  • SMTP Server Program: (servers ip or clients ip can be its dns name below.) 1. Listen to the given port and wait for a connection request from a SMTP Client.
    1. Create a new thread for every incoming TCP connection request from a SMTP client. Send the 220 response including servers ip address or dns name to the SMTP client.
    2. Implement the following 3-phase data transfer procedure (see step 4 on client side):
      1. Wait for, read, and display the HELO command from the SMTP client. If the incoming command is NOT HELO , sends 503 5.5.2 Send hello first response to the SMTP client and repeat step 3.a.
      2. Send the 250 <servers ip> Hello <clients ip> response to the SMTP client.

MSU Denver, M&CS CS 3700-001: Computer Networks, Spring 2020 Dr. Weiying Zhu

  1. Wait for, read, and display the MAIL FROM: command from the SMTP client. If the incoming command is NOT MAIL FROM: , sends 503 5.5.2 Need mail command response to the SMTP client and repeat step 3.c.
  2. Send the 250 2.1.0 Sender OK response to the SMTP client.
  3. Wait for, read, and display the RCPT TO: command from the SMTP client. If the incoming command is NOT RCPT TO: , send 503 5.5.2 Need rcpt command response to the SMTP client and repeat step 3.e.
  4. Send the 250 2.1.5 Recipient OK response to the SMTP client.
  5. Wait for, read, and display the DATA command from the SMTP client. If the incoming command is NOT DATA, send 503 5.5.2 Need data command response to the SMTP client and repeat step 3.g.
  6. Send the 354 Start mail input; end with <CRLF>.<CRLF> response to the SMTP client.
  7. Wait for, read, and display the Mail message from the SMTP client line by line. (hint: . is the ending signature.)
  8. Send the 250 Message received and to be delivered response to the SMTP client.
  1. Repeat Step 3 until the QUIT command is read. Upon receiving QUIT, send the 221 <servers ip> closing connection response to the SMTP client and go to Step 5.
  2. Close all i/o streams and the TCP socket for THIS Client, and terminate the thread for THIS client.

Part II (15%): Test your programs on the Virtual Servers in the cloud and your laptop/home computer.

Warning: to complete this part, especially when you work at home, you must first (1) connect to GlobalProtect using your NetID account (please read how to connect to GlobalProtect at https://msudenver.edu/vpn/); then (2) connect to the virtual servers cs3700a and cs3700b using sftp and ssh command on MAC/Linux or PUTTY and PSFTP on Windows.

ITS only supports GlobalProtect on MAC and Windows machines. If your home computer has a different OS, it is your responsibility to figure out how to connect to cs3700a and cs3700b for programming assignments and submit your work by the cutoff deadline. Such
issues cannot be used as an excuse to request any extension.

  1. MAKE a directory HW4 under your home directory on cs3700a.msdenver.edu and cs3700b.msudenver.edu, a subdirectory server under HW4 on msudenver.edu, and a subdirectory client under HW4 on cs3700b.msudenver.edu.
  2. UPLOAD and COMPILE the server program under HW4/server and the client program under HW4/client on the VMs.
  3. TEST the server program running on cs3700a.msudenver.edu together with a client program running on your laptop or lab computer and another client program, simultaneously, running on cs3700b.msudenver.edu to test all the possible cases.
  4. SAVE a file named txt under HW4/client on cs3700b.msudenver.edu, which captures the outputs of your client program when you test it. You can use the following command to redirect the standard output (stdout) and the standard error (stderr) to a file on UNIX, Linux, or Mac, and view the contents of the file

java prog_name_args | tee testResultsClient.txt //copy stdout to the .txt file //if you want, you may also use script command instead of the tee command

//to write both stdin and stdout into testResultsClient.txt while testing your

//client program on cs3700a. For how to use script, see

// https://www.geeksforgeeks.org/script-command-in-linux-with-examples/ //or Google script command in Linux if the above link is broken.

cat file-name //display the files contents.

Shopping Cart
[Solved] CS3700-001: Computer Networks HW #4: Simplified SMTP on TCP
$25