in reply to Which IPCs are available on Windows that support select() function besides sockets?

If the processes that want to communicate have a common parent, you can use socketpair to create a non-IP socket they can talk over. The parent would have to create the sockets, then allow them to be inherited by a child across a fork.

You can fake this up to an extent by creating a "launcher" program to create the sockets and start up the right programs. If you end up starting other scripts with exec or system, make sure you don't cause the file descriptors to be closed when you start the new program; the easiest way to do this is by setting $^F to a high number.

  • Comment on Re: Which IPCs are available on Windows that support select() function besides sockets?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Which IPCs are available on Windows that support select() function besides sockets?
by Anonymous Monk on Oct 16, 2005 at 23:23 UTC
    Ummmm... the operating system is MSWin32... he doesn't have access to socketpair (according to perlport anyway) and definitely doesn't have access to fork. Unless he is running cygwin that is.
      I regularly use both socketpair and fork in my MSWin32 Perl apps with ActiveState perl, and both work OK, though fork can be a little fussy.

      It does seem that perlport(1) says socketpair is unavailable, which seems to be incorrect. My copy of perlport(1) says fork is properly emulated on Win32, though. This is the documentation that comes with Perl 5.8.1.

      It may be that socketpair is implemented in terms of IP sockets, though, which means it wouldn't help the OP. I don't recall, and don't have a copy of Windows handy to test with.

        Thanks for that. I had just accepted perlport's view of the world with regard to socketpair. Should have remembered that functionality continues to be added. :)