I don't see anything wrong with the code above. From your description it sounds like it may be the client. A way to test this would be to have a second client connect to your server from another pc after you do a ctrl-c on the first client. If the second client can't connect then it is a problem with the server. If it can connect then it is a problem with the client. Let me know what happens.