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.7 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 4DBCDBC0A for ; Thu, 24 May 2007 13:33:09 +0200 (CEST) Received: from home.mk.pp.ru (av6800.comex.ru [217.10.34.155]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4OBX8Wf031091 for ; Thu, 24 May 2007 13:33:09 +0200 Received: from ermine.home (ermine.home [192.168.2.2]) by home.mk.pp.ru (Postfix) with ESMTP id 36E4720B45 for ; Thu, 24 May 2007 15:33:08 +0400 (MSD) Received: by ermine.home (Postfix, from userid 1001) id 7CA173A9C86; Thu, 24 May 2007 15:33:26 +0400 (MSD) Date: Thu, 24 May 2007 15:33:26 +0400 From: Anastasia Gornostaeva To: caml-list@yquem.inria.fr Subject: Unix.select + Stream or ulex Message-ID: <20070524113326.GA3637@ermine.home> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-06) X-Miltered: at discorde with ID 465577F4.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; parser:01 unix:01 unix:01 functions:01 data:02 string:02 string:02 let:03 let:03 stream:04 stream:04 size:95 size:95 create:12 idea:12 Hello. I attempt to use ulex based xmlparser for xml streaming together with Unix.select to manage multiple connections, but I cannot figure out how to use ulex (and Stream functions) in this case: let infds, _, _ = Unix.select infds [] [] time in if infds <> [] then let str = String.create 1024 in let size = Unix.read fd str 0 1024 in try let xml = UlexBased.parser_xml (String.sub str 0 size) in process_xml xml (* the str was enough to have complete xml stanza *) with Stream.Failure -> () (* wait for future data *) ... Any idea? Thanks ermine