in reply to Sockets

It seems okay and works here (Solaris 2.6).
Maybe try a different telnet client.
It doesn't accept multiple clients though.

BTW, since you are doing only the server side, why do you implement a client side as well?

Two other small comments:
1. You don't need the $line=""
2. You can remove the 'defined'