From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A9179BCA5 for ; Wed, 23 Aug 2006 09:03:00 +0200 (CEST) Received: from mail-outfwd.lms.be (Kaiserslautern1.lms-gmbh.de [213.68.136.230]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7N730dm020348 for ; Wed, 23 Aug 2006 09:03:00 +0200 Received: from localhost (unknown [127.0.0.1]) by mail-outfwd.lms.be (Postfix) with ESMTP id 011B17F4AB; Wed, 23 Aug 2006 09:31:10 +0200 (CEST) Received: from mail-kl.lmsintl.com ([127.0.0.1]) by localhost (kl-ftp [127.0.0.1]) (amavisd-new, port 20024) with ESMTP id 07924-07; Wed, 23 Aug 2006 09:31:09 +0200 (CEST) Received: from kaiserslautern1.lmsintl.com (unknown [10.2.0.100]) by mail-kl.lmsintl.com (Postfix) with ESMTP id E52D8B6ECF; Wed, 23 Aug 2006 09:31:09 +0200 (CEST) Received: by kaiserslautern1.lmsintl.com with Internet Mail Service (5.5.2653.19) id ; Wed, 23 Aug 2006 09:02:45 +0200 Message-ID: <26EB47FDD566A7469FC862DAF373792F018CF5D0@kaiserslautern1.lmsintl.com> From: Christoph Bauer To: Jonathan Roewen , Nathaniel Gray Cc: Caml Mailing List Subject: AW: [Caml-list] Re: Select on channels (again) Date: Wed, 23 Aug 2006 09:02:44 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Virus-Scanned: by IT Services X-Miltered: at nez-perce with ID 44EBFDA4.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; unix:01 unix:01 ocaml:01 descriptors:01 ocaml:01 stub:01 unixsupport:01 camlprim:01 stub:01 camlparam:01 val:01 failwith:01 camlreturn:01 val:01 sockets:01 > 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 #include 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