CSCI561 - Computer Networks

Program Two

Using Steven's echo client as a starting point, create a client that connects to the well known SMTP port 25 and sends an email.

See class handout and for RFC2821.


  1. Test an SMTP server by telneting to port 25 on most any server.
            telnet 25
  2. Add the socket reuse option. See p 192.
    setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on));
  3. Use the minimal set of commands in your Stallings handout to hand contruct an email.
  4. Note that functions for the User-Mail-Agent are embedded in the DATA field and require the xxx: format such as "To:" "Cc:" etc.
  5. Have the client program send an email. You may want to read a text file and write it to the SMTP server.
  6. Regardless of how your client reads the data (email) to send, your client program must wait for, receive, and process each reply from the SMTP server.

Once the program is working properly, use the script program (type "man script" to see how to use it) to show your source changes, the compiler output, and the execution of the server.