The platform is windows xp. There should be only ONE programm/dos-window.

I need a UDP server on the xp machine who is sending constantly (every n seconds) to 5 clients (SPS) in a LAN even if the clients do not send a request (UDP is not reliable, maybe the SPS are dead).
The server is also receiving periodically requests from the clients and then responding them (normal operation of the system).
The requests should be displayed graphically (for instance with a perl/tk listbox).

How can I manage the timing, because in my opinion there are several endless loops
* the server should send
* the server should receive
* the endless loop of the perl/tk MainLoop with the periodically refreshed listbox.

For the perl/tk MainLoop I asked in this forum "listbox refresh with Tk::After" and got a working answer with the command repeat.

I got a server who receives/listens and responds immediately to request in a while (1){} loop. How can I integrate, that the server should also send periodically if there are no requests ? Maybe a timeout for the receiving loop ?

How can these demands be integrated in one programm ?

I would have thought of two different programms , a server and the graphically perl/tk programm, where the programms communicate via files, but there should be only ONE doswindow. Maybe it is possible to let the doswindow dissappear after e.g. the perl/tk programm is started ?

A last problem, the client who is not requesting after m seconds should be marked with a different color in the perl/tk GUI, for instance his last request should have a red background, all others have a green background. I think this is not possible with a normal listbox. What alternative would you suggest ?

I appreciate each hint, thanks in advance.


In reply to endless loops for server and tk by hudo

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.