Modify ↓
Ticket #86 (closed defect: wontfix)
Use on socket connections with non blocking flag set
| Reported by: | oscar.ostlund@… | Owned by: | xi |
|---|---|---|---|
| Priority: | normal | Component: | libyaml |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I am trying to use yaml as a communication language between processes that are connected through sockets. When I open sockets, I use non blocking sockets. Thus when libyaml tries to read the file with fread, it returns an error. Indeed, as the non blocking flag is set, when there is nothing more to read, the fread call returns EWOULDBLOCK.
As a hack, I have modified the yaml_file_read_handler function to return 1 if errno == EWOULDBLOCK and !ferror in the other cases...
What do you think ?
Thanks for your help
Oscar
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

I think it is better if you define a custom read handler and register it with yaml_parser_set_input(). You may use the code of yaml_file_read_handler() as a start. The standard file read handler is supposed to be used for simple tests and examples. For a networking application, it is better to define a specialized read handler.