in reply to hung reading first line of socket

If your code works for others, then I doubt that rewriting the script would be necessary. You might want to see what is different about the client's machine.

I ran into a similar problem when a server changed SMTP ports from 25 to 26, but you say you are using the same port with telnet. It would be nice of you could get an error message.