I am looking to write a load-balancing proxy system, and am running into a few problems. This system would accept a socket connection, read several lines from the socket, and send the data to one of 13 sockets, read the data recieved from that socket, and write it to the accepted socket. The problem I am having is the 13 connections require keep-alives every 10 minutes, and if it loses the login, it needs to re-login.


Example: client connects to proxy, proxy decides that it last sent data to server[11], proxy sends data to server[12], proxy notices that server[8] has not had data sent to it in 10 minutes +, proxy sends a keep-alive to server[8], proxy (finally) recieves data from server[12], proxy sends data from server[12] back to client, client closes connection.

After thinking long and hard about this, the only way I can think of to do this is with a whole bunch of forks, and I am thinking that their has to be a more elegant way. Please help. Tim

In reply to keeping open stateful connections. by PseudoVampyre

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.