This function receives notifications about all events raised by a connection established as a result of execution of functions rascal_connect
, rascal_connect_service
or rascal_accept
. The return value is ignored, unless explicitly stated otherwise.
bool __rascall rascal_dispatcher( rrid_t conn, const sock_t *peer, int event, void *context );
Parameters.
conn
Request identifier. The application must test this value with the rascal_isok
function to see if the operation failed or succeeded.
peer
The address of the remote connection endpoint. If the remote address is not known by the time the event is delivered, this parameter is filled with zeros.
event
The type of the event.
Table F.1. Event types
Code | Meaning |
---|---|
rop_accept |
A connection was accepted. To allow the connection, dispatcher must return The value of The |
rop_close |
The connection is closed. The |
rop_connect |
The connection attempt is finished. The values of |
rop_listen
|
The library has successfully started accepting incoming connections on the specified address.
The handler can still return |
rop_read |
More data is available in the incoming buffer.
The full amount of available data can be determined by a call to For stream oriented connections (established over TCP), the frequency of these events is undetermined and can vary from one byte to iseveral kilobytes having been received. For datagram connections (established over UDP), this event is delivered for each received datagram. |
rop_write |
A portion of data was successfully sent to the connection. For stream oriented connections (established over TCP), the frequency of these events is undetermined and can vary from one byte to the whole buffer having been sent. For datagram connections (established over UDP), this event is delivered for each sent datagram. |
context
The value passed to rascal_connect
or other function that establishes a connection, unaltered by the library.