Re: solution for fileevent on Win32 ???
by pc88mxer (Vicar) on Jul 10, 2008 at 17:03 UTC
|
This exact issue is discussed in the section "Polling Win32 Sockets" of the book "Mastering Perl/Tk: Graphical User Interfaces in Perl".
The basic idea is to set up a timer event to poll the socket.
As for other serialization formats, you might consider YAML or Storable. | [reply] |
|
|
thanks for your promptly responses.
I did try to use the timer event but I don't see which method you can use to send data through the socket at the sender part.
When you call the can_read method, can you get the event data or just the boolean value saying if there is any available data at the socket?
| [reply] |
|
|
| [reply] [d/l] [select] |
|
|
Re: solution for fileevent on Win32 ???
by zentara (Cardinal) on Jul 10, 2008 at 19:29 UTC
|
See Non-blocking socket read on Windows. I "think" that fileevent will work on Win32, did you try it?
The problem with fileevent on Win32, is that it won't work on pipe filehandles( you need the Win32::Pipe module). But it should works on sockets. IPC::Run(which uses sockets)is often suggested as an IPC substitute for IPC::Open3 (which uses pipes), for use on Win32.Here is an example, see if it runs for you on Win32. Tk Realtime data aquisition
| [reply] |
|
|
I tried using fileevent command and it didn't work on Win32 and you were right about the handle. Thanks.
I'm still working on the timer event to see if I could get around the problem. And hmm having error while trying to open the socket.
| [reply] |
|
|
| [reply] |
|
|
Re: solution for fileevent on Win32 ???
by jethro (Monsignor) on Jul 10, 2008 at 16:44 UTC
|
2. You could make a timer event that checks for that incoming event. Depends on how real time your real time constraint really is.
Second possibility could be to find an X event that could be hijacked to signify your event, but that sounds to me a bit like a hack. | [reply] |