I did not see the typed text from the client to the server.

You may have a Window's related problem, where Tk's fileevent dosn't work reliably on some version of windows. See Client/Server sockets with TK on Win32 .

There are workarounds, see Another Win32 Tk fileevent work around : using ioctl() properly for instance. If that dosn't work for you, it's possible to use a conventional select loop with sysread in a separate subroutine, and call it with a Tk timer every 10 milliseconds. See Tk fileevent with win32 sockets for a timer solution.

It goes something like this untested code:

... other Tk code my $timer = $mw->repeat(10, \&read_it ); MainLoop; sub read_it{ my $client = $listen->accept or die "Accept failed: $!"; if( IO::Select->new($client)->can_read(5) ) { sysread( $client, $_, 1 ) and print; } else { print "Timeout\n"; } close $client; }

Also see Mastering Perl/Tk and the Window's fileevent problem

If you are an eager seeker of Perl knowledge, I will tell you that another, more advanced GUI toolkit, called Gtk2 does have an IO watch ( like fileevent ) which does work on Windows, see Simple threaded chat server for a simple example to test with.

Finally, you could just put Ubuntu Linux on your Desktop with a dual boot to Windows. :-)

Finally, just to get you banging your head against the wall, I found an example of Wx using sockets, see Wx Socket. It probably works on Windows.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re^3: Server with GUI by zentara
in thread Server with GUI by gg4000

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.