I'm needing to write a program that can run 1, 2 or both socket servers and display their output in a list box in real time.

Ah, a perfect time for me to learn Tk! So I put together this nice interface with the top half for server1 and the bottom have for server2. Each has a button to start and stop the server and each a list box for output.

Then I started to implement the servers as Threads and then the trouble began with various kinds of crashes. A SuperSearch provided some info here that threads may not get along with Tk.

I tried launching a new thread in a sub that was called when clicking a button. That seemed okay but the thread tries to log a message to the listbox and that appears to be a problem even when I declare the sub as "sub name : locked {}".

So I'm looking for other strategies for acomplishing my task. Threads, no threads, it doesn't matter. It has to run on Win2k or WinXp. I'm using perl 5.8.7. I need to be able to start and stop the servers at any time.

Oh wise Monks, can you show me a path?


In reply to How to run multiple server processes under Tk? by noslenj123

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.