Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
That's quite a lot of stuff in the "Win32 LIMITATIONS" section in that module's POD. ;)
But that is the nature of the beast. In Win32, select() only works on sockets, so use those instead of pipes. Tk::fileevent() also doesn't work, so setup a Tk::repeat() callback to invoke your read_socket() function at suitable intervals when $^O eq 'MSWin32' (in Unix context, stick with fileevent though, it's more efficient). read_socket() just calls select() on the socket, and if there's data it goes and does a non-blocking sysread() and dumps that stuff into a buffer (don't forget to check for errors and handle EWOULDBLOCK). You parse the buffer for network-portable EOL sequence (\015\012) and every time you get a whole line of data, you do whatever you need with it.
It's kind of hairy, and much more complex than what could be done in a pure Unix environment, but at least it works. Other methods may not work so well...
If you don't already have it, I hightly recommend the book "Network Programming with Perl" (by Lincoln Stein), it explains this stuff very well, and touches on limitations of Win32 and how to get around them. It also has lots of example code, including a multiplexing server, should you need that...

In reply to Re^2: Perl/Tk App and Interprocess Communication by perlhaq
in thread Perl/Tk App and Interprocess Communication by beretboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found