From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 48632BC88 for ; Mon, 7 Feb 2005 11:30:19 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j17AUIaj019593 for ; Mon, 7 Feb 2005 11:30:19 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA30809 for ; Mon, 7 Feb 2005 11:30:18 +0100 (MET) Received: from distrib2.mail.u-psud.fr (distrib2.mail.u-psud.fr [129.175.34.154]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j17AUI5t022680 for ; Mon, 7 Feb 2005 11:30:18 +0100 Received: from intfiltre1.mail.u-psud.fr (intfiltre1.mail.u-psud.fr [129.175.34.149]) by distrib2.mail.u-psud.fr (8.12.10/8.12.0.Beta10) with ESMTP id j17AUIhT023087 for ; Mon, 7 Feb 2005 11:30:18 +0100 Received: from post1.mail.u-psud.fr (post1.mail.u-psud.fr [129.175.34.87]) by intfiltre1.mail.u-psud.fr (8.12.10/8.12.0.Beta10) with ESMTP id j17ATef5032096 for ; Mon, 7 Feb 2005 11:30:17 +0100 Received: from tahiti.ile.u-psud.fr (tahiti.ile.u-psud.fr [172.17.4.7]) by post1.mail.u-psud.fr (8.12.10/8.12.0.Beta10) with ESMTP id j17ATXcC019767 for ; Mon, 7 Feb 2005 11:29:33 +0100 Received: from laposte.net (Naoned.ile.u-psud.fr [172.17.4.237]) by tahiti.ile.u-psud.fr (Postfix) with ESMTP id D69F93CD994 for ; Mon, 7 Feb 2005 11:29:37 +0100 (CET) Message-ID: <420743F9.2000703@laposte.net> Date: Mon, 07 Feb 2005 11:33:29 +0100 From: =?ISO-8859-1?Q?Olivier_P=E9r=E8s?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.6) Gecko/20040115 X-Accept-Language: br, fr, en MIME-Version: 1.0 To: Caml-list Subject: Re: [Caml-list] Socket and Threads on windows References: <1107765700-e20070018019e5a283e3267b340928dc@rashitoul.net> In-Reply-To: <1107765700-e20070018019e5a283e3267b340928dc@rashitoul.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Scanned: by amavis X-Miltered: at concorde with ID 4207433A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4207433A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 threads:01 sockets:01 trivial:01 buffer:01 buf:01 blit:01 buf:01 decoding:01 gpl:01 peres:98 peres:98 unix:01 unix:01 marshal:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: Julien Boulnois a écrit : > let (ic,oc)=(Unix.in_channel_of_descr sock,Unix.out_channel_of_descr sock);; According to the manual, none of *_channel_of_descr works on sockets on Windows 95/98/Me. What are you using ? As for me, to avoid that kind of problems, when writing Amble I made my own send/receive functions. Send is trivial (Marshal to string and Unix.write), receive is also pretty simple : let receive_message fd = (* 1 - allocate and read the header *) let hs = Marshal.header_size in let headerbuf = String.create hs in let hlen = Unix.read fd headerbuf 0 hs in (* 2 - prepare the buffer as a string that has the same size as the message * and copy the header in the beginning *) let ds = Marshal.data_size headerbuf 0 in let buf = String.create (hs+ds) in String.blit headerbuf 0 buf 0 hs; (* 3 - receive the rest of the message (data part) *) let dlen = Unix.read fd buf hs ds in (* 4 - decoding (unmarshalling) *) Marshal.from_string buf 0 You can get the whole thing from http://home.gna.org/amble/ ; licence : GPL. Hope this helps, Olivier.