CS3060 (Spring 2013): Programming Assignment 3

TCP Echo Server


Background

This program will give you practice building TCP socket programs. You will need to do a little bit of research for this one, but most of the code can be adapted from the examples I did in class on 26 Feb.

Instructions

  1. You can probably accomplish this program in a single file, though I recommend breaking it into several functions. Eventually, we will be building programs where the bulk of the functionality we are working with here will be encapsulated in objects, so keep in mind how you might accomplish this.
  2. Using winsock2, create, bind, listen, and accept connections on a socket. When a connection is accepted, it should read from the socket and respond with the same message until the socket is closed. Keep in mind that recv tells you how many characters have been received and you can use this to determine if the client is still connected.
  3. Before sending the message back, precede the message with a string indicating the current date and time.

Deliverables

Submit all source code in as compact a format as possible.