Skip to main content

Name

trywritef — Write formatted data for an event

Synopsis

#include "ec_growbuf.h"

| int **trywritef** ( | event, |   | |   | buffer, |   | |   | ...); |   |

Event * <var class="pdparam">event</var>; const char * <var class="pdparam">buffer</var>; <var class="pdparam">...</var>;

Description

Write formatted data 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 = trywritef(event, "250 OK\r\n");

Warning

This function assumes that the buffer is a maximum of 4096 bytes.

Parameters

event

An event.

buffer

The string to write. This may be a format string.

...

The variable argument(s).

Return Values

This function returns 1 on success and 0 on failure.

Threading

It is only legal to call this function in the Scheduler thread.

See Also

Was this page helpful?