-
-
Notifications
You must be signed in to change notification settings - Fork 104
AsyncIO
There are three implemented methods to perform asynchronous IO, with the hope of emulating the sort of IO you find on micro-controllers. The three methods are UDP and TCP sockets and POSIX message queues.
Documentation can be found here.
Both protocols have the same functionality, differing only in that the UDP callback is called for every received transmission whilst the TCP callback is called for every established connection. Both work by establishing a connection to the given IPv4 dot-decimal address and port.
Similarly to UDP sockets, message queues trigger their callback once for each message received. The message queue names, unlike the Linux POSIX implementation, do not require the prepending '/'.
Each type of connection can be assigned its own callback function. The callback, if provided (else NULL
), must take three arguments: size_t
, char *
, void *
. These parameters, respectively, provide the callback with the number of bytes received into the buffer, the buffer and the args given as an argument when the connection was created.
aIOMessageQueuePut
and aIOSocketPut
can be used to send a char *
buffer to either a message queue (specified using the message queue's name) or a socket (specified using an IPv4 dot-decimal address and a port).
Authors: Philipp van Kempen, Alex Hoffman