It would be easy if you could switch to threads. :-) Interthread communication is easy.
One possible forked solution would be to include a control socket( on some local port) in every fork, in recv mode, and add that to the listening select array in the forked server. Then if the forked server reads it's id on the control socket, it should disconnect and close it's socket.
I'm not sure I understand the problem fully, but couldn't you let the server keep a hash( database) of all live connections, and include the username and number of logons, remote ip addresses, and the socket filehandles assigned. Then if the count exceeded 1, send a control code thru the control socket to close those connections?
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.