in reply to Sending and recieving data

I'm not a fellow, but I'll answer anyway :)
It's unclear from your code if that is the server you are starting, or a client. If its the server, it should be doing a 'Listen' to the port, accepting client connections, and reading from them, rather than the server itself.
If it's a client then what you are doing is connecting to a server, looping on the lines read from the server, and sending them back to the server.

What you need is a server which listens to a port, spawns off 'child-sockets' to deal with the clients, and writes each line received from the clients to the other clients.
I answered a question similar to this recently, and I have a sneaking feeling it was also from you :)
Re: Socket: Server shall send same $line to several clients

The short answer is no, it wont quite work.

C.