Browse thread
Unix.select + Stream or ulex
- Anastasia Gornostaeva
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Anastasia Gornostaeva <ermine@e...> |
| Subject: | Unix.select + Stream or ulex |
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