I am learning the Socket API in Perl now. I am new to this, so I'm sorry if the question is stupid, but I have already searched the net with no results. I need to create one server and several clients. I have already created a client and a server and they are successfully communicating with each other, but now I need to have one server and many clients. The clients are sending some information to the server, which should handle it. Let me explain using simple example. The server is the handler for client requests, and it can display on a terminal screen the statistics of network usage or other information coming from the clients. I need to display all clients' information at once, so the server should have the ability to switch between them. Let's assume that there are four clients connecting to the server. At present the server displays only the second client's information. If I click some button it will switch to another available client in queue or just randomly, and now the information from the third client is displayed, and so on. I need to work with only one client at a time. Also I don't need to store information from clients if it isn't in focus right now. I have tried to create something like that, but I feel that I have a lack of knowledge now and need some more practice. Please provide any relevant examples which can help to implement this task. Or just some good direction to follow (books perhaps, or tutorials.)

In reply to How to serve multiple socket clients Perl by perlnwb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.