RFC 867 defines the very simple daytime protocol. So we need to write a server for it. Here is an example of a server written with Cleansocks. Like it, your server should should take an optional port number on the command line, or use the standard daytime server port otherwise. (The port number is 13, but don't hard-code it, look it up as usual.) As we know, the service is very simple. Your server should wait for connections on the specified port. When a client connects, do not read anything from the client, simply send a single line of text containing the date and time, terminated with \r\n, then close the connection.
Since RFC 867 does not specify the format of the time string, you are free to send anything reasonable. You should read the time from the system clock and format it as a string. Use the standard Unix/C time function to get the time, and some reasonable combination of formatting functions, ctime and friends and/or strftime to generate an appropriate string. (Alternatively, you may use the much newer C++ chrono facility. Seems like more work.)
Your program should:
Note that your server is an infinite loop. It ends when you kill it with control-c. In addition, I printed a message to the console when a client connects. That's useful to see what's going on. Generally, though, a server doesn't have much to say on the console. It does its talking on the network.
I used a port number other than the standard one because, on a Unix system, only the administrator can run servers on ports 1-1024. This was a bit of a security precaution from back when computers were expensive, and were never owned by one person. I don't know if Windows supports this restriction. The 127.0.0.1 in the server messages is the IP address of localhost.
To use your server over an actual Internet connection, you may find yourself fighting firewalls. If you have multiple machines at home, you can run your server on one and client on another. You may need to open the port you're using in the firewall on the server machine. A Windows box may offer to do that for you when you run the server and it notices the listen. Alternatively, if you run your server on Sandbox, it happens that ports 45000-45500 are open for occasional use by FTP data connections. You might find you can run your server somewhere in that port range and connect to it remotely.
When your program is working, nicely commented and properly indented, submit it using the form here.