​​Dear Paolo and Anders, Thank you for your messages. I tried to use Paolo's code and the exception Timeout was raised. I was not able to read char by char without O_NONBLOCK : the program is just waiting forever for something to read. I was able to retrieve some data using Unix.in_channel_of_descr, but the data are not transmitted synchronously, which is required in my case. Thus, I will probably rewrite this part in C using the same strategy and see if it works. I cannot understand why this strategy works for HyperTerminal and not for me with the same material. Thank you again. Edouard 2014-08-18 17:10 GMT+01:00 Adrien Nader : > Hi, > > You cannot safely mix buffered (in/out_channel) and un-buffered > (file_descr) uses of the same underlying resource. > > IIRC an in_channel or out_channel has a buffer in OCaml memory. > If you close the underlying file_descr of an out_channel with > functions operating on file desriptors directly, it is possible that > some data will still be buffered. > If you read alternatively through file_descr and in_channel, you might > skip some data if reading with the in_channel reads more than just "n > chars" (it could read 4K for instance, I'm not completely sure). > > As for using in/out_channel_of_descr more than once, I don't know > offhand: if it creates new buffers each time (likely), it will be an > issue. > > -- > Adrien Nader > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Edouard Evangelisti Post doctoral Research Associate Sainsbury Laboratory, Cambridge University (SLCU) Bateman Street Cambridge CB2 1LR (United Kingdom)