I'm working on a Perl project that has a client sending requests to a server and the ssl connection used for this is kept open until the response is complete. What I want to do is add a layer between that queues the requests and possibly combines them when is makes sense to do so. So it will listen for client requests and then bundle them to send to the server. When the server responds, the response will be broken up to send back to the requesting clients. I'm not a Perl expert but I've been doing software for a while. Here is what I have tried to do on the server side. I created a thread for listening for incoming request, one for listening to responses from the server and one for working the Thread Queue I created to hold the requests. I'm not sure this is the correct architecture in the first place, but my problem seems to be that I can't put the connection into the queue so it can be used later when this layer needs to send a response to the clients.

Is there a way to do this? Or should I push for a redesign of the way communications are done between client and server? I'm starting to think a redesign would be best, but this would require a listener on the client side for responses and matching them up with previous requests.

Any response would be appreciated

In reply to threadpools and tcp connections by Anonymous Monk

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.