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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.