in reply to Re: Server with GUI
in thread Server with GUI
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Server with GUI
by zentara (Cardinal) on May 30, 2012 at 10:40 UTC | |
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:
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 | [reply] [d/l] |
by gg4000 (Novice) on May 30, 2012 at 16:16 UTC | |
Thanks for all the info. I will play with it when I get home from work. | [reply] |
by gg4000 (Novice) on Jun 01, 2012 at 23:46 UTC | |
Had things happen with Tk, had things happen with Wx. I'm back to the start. Wx.The window opens after the server gets a connection. The Window has to open and display the IP First. Then display the text from the client. And display the next set of text from the client.And send the commands to the computer. I'm still stuck with "What to do instead of While" And a test client..... Run the server first. Type anything into the client. Commands are if you have X10 installed "A1 On" | [reply] [d/l] [select] |
by zentara (Cardinal) on Jun 02, 2012 at 10:28 UTC | |
But back to Wx: I don't have Wx running, but looking at your server code, I see you did not get the previous point I was making about GUI eventloop code, and using sleep, system, while loops, select loops, or anything which interferes with the eventloop. Your code , as written, will just hang in the while loop, making the Wx eventloop freeze up. I don't even have to run it to see that. You must use Wx::Socket to run sockets in Wx. Otherwise, you need to put all your while loops into a separate thread, and at your level of programming experience, I doubt you are up to that hassle. Go back and rewrite your code using the example code in Wx::Socket I'm not really a human, but I play one on earth. Old Perl Programmer Haiku ................... flash japh | [reply] |
by gg4000 (Novice) on Jun 02, 2012 at 22:38 UTC | |
by zentara (Cardinal) on Jun 03, 2012 at 09:42 UTC | |
| |
|
Re^3: Server with GUI
by gg4000 (Novice) on May 30, 2012 at 10:34 UTC | |
Can't locate Tk.pm in @INC (@INC contains: C:/Dwimperl/perl/site/lib C:/Dwimperl /perl/vendor/lib C:/Dwimperl/perl/lib .) at monkserver.pl line 5. Seems like it should be easy to fix, but I don't know what a @INC is. | [reply] |