* AW: [Caml-list] Re: Select on channels (again)
@ 2006-08-23 7:02 Christoph Bauer
2006-08-23 7:44 ` Robert Roessler
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Bauer @ 2006-08-23 7:02 UTC (permalink / raw)
To: Jonathan Roewen, Nathaniel Gray; +Cc: Caml Mailing List
> Why can't you just use the unix file opening functions since
> you're using unix select? And if you need the ocaml in/out
> channels, convert the unix file descriptors to ocaml ones
> instead of the other way around. Seems simple enough to me.
I did this, but on windows with two programs communicating over
a pipe this isn't enough. select on windows and on a pipe doesn't
work. Therefore I wrote a stub for PeekNamedPipe():
#include <caml/unixsupport.h>
#include <windows.h>
CAMLprim value peeknamedpipe_stub( value fd ) {
CAMLparam1( fd );
DWORD available;
if( !PeekNamedPipe( Handle_val( fd ), NULL, 0, NULL, &available, NULL ) )
{
failwith( "peeknamedpipe failed");
}
CAMLreturn( Val_int( available ) );
}
I use select on Unix and peednamedpipe on windows.
Communication over sockets could be another solution, because then select
should work on windows, too.
Christoph Bauer
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: AW: [Caml-list] Re: Select on channels (again)
2006-08-23 7:02 AW: [Caml-list] Re: Select on channels (again) Christoph Bauer
@ 2006-08-23 7:44 ` Robert Roessler
0 siblings, 0 replies; 2+ messages in thread
From: Robert Roessler @ 2006-08-23 7:44 UTC (permalink / raw)
To: Caml-list
Christoph Bauer wrote:
> ...
> I did this, but on windows with two programs communicating over
> a pipe this isn't enough. select on windows and on a pipe doesn't
> work. Therefore I wrote a stub for PeekNamedPipe():
"Select on windows" certainly does work... and why not use a socket
pair, just as one might on a *nix system? That way, it will work on both.
And the fact that socketpair has been left out of the Windows version
of the Unix module is not an impediment - it is easy to write a useful
implementation in OCaml (I can supply one if needed).
Robert Roessler
roessler@rftp.com
http://www.rftp.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-08-23 7:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-23 7:02 AW: [Caml-list] Re: Select on channels (again) Christoph Bauer
2006-08-23 7:44 ` Robert Roessler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox