Computer Networking — Writing TCP clients

Writing a client program

In a recent lecture we looked a several implementation of a line echo server written in Python. Take a another look at one of the threaded implementations. Right now that server is running on port 40373 of You should be able to connect to it using nc.

[…]$ nc 40373
Echo....   Echo....   Echo....   Echo....   

The client program

You task is to write a Python client application that connects to the server running on port 40373 of and sends it an input line containing your name until your client receives a response where the beginning line number is a multiple of 7.

You can start with the example client program shown in the Python socket documentation. However, I do recommend that you try using makefile, as shown in the server example, to get a robust implementation that would work for Homework 2.

Here is a one line example of how to extract the line number.

linenumber = int("77: Sunset Strip".split(':')[0])