Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[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: <altavillasalvatore@l...>
Subject: [Caml-list] TIME-OUT
Hi All,

My problem is this:

let risposta byte =
let pdu_length = String.length byte in
let my_name =Unix.gethostname() in
let my_entry_byname = Unix.gethostbyname my_name in
let my_addr = my_entry_byname.Unix.h_addr_list.(0) in
let sockaddr = Unix.ADDR_INET(my_addr, 161) in
let sock = Unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0 in
let sock1 =  Unix.ADDR_INET(my_addr, 12346) in
Unix.bind sock sock1;
let w = Unix.sendto sock byte 0 pdu_length [] sockaddr in
let max = 512 in
let buf=ref (String.create max) in
let len, addr =Unix.recvfrom sock !buf 0 max [] in
Unix.close sock;
let answer = String.sub !buf 0 len in

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


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: