Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] TIME-OUT
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Beck01, Wolfgang <BeckW@t...>
Subject: RE: [Caml-list] TIME-OUT
altavillasalvatore@libero.it wrote 

> I would want to introduce a Timeout for input operations (a floating-point value
> representing a time in seconds) of 15 second.

use 'select':

let rd_ready, wr_ready, exc_ready = select [sock] [][] 15.0
in
match rd_ready with
  h :: _ ->
	Unix.recvfrom h !buf 0 max []
| [] -> (* handle timeout *)

'select' on Windows is restricted to sockets, on Unix you can
use any file_descr.

--
Wolfgang Beck
T-Systems Nova GmbH 
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners