Name
trywrite — Write a string of buflen bytes for an event
Synopsis
#include "ec_growbuf.h"
| int **trywrite** ( | event, | |
| | buffer, | |
| | buflen); | |
Event * <var class="pdparam">event</var>;
const char * <var class="pdparam">buffer</var>;
int <var class="pdparam">buflen</var>;
Description
Write a string of buflen bytes for an event.
Note
This function assumes that the event closure is an “accept_construct”.
Note
All events are assumed to be non-blocking, so the write semantics are non-blocking.
A sample call:
i = trywrite(event, ".\r\n", 3)
- event
-
An event.
- buffer
-
The string to write.
- buflen
-
The length of
buffer, in bytes.
This function returns 1 on success and 0 on failure.
It is only legal to call this function in the Scheduler thread.
See Also
Was this page helpful?