Skip to main content

rt_set_callback

Description

The rt_set_callback function is used to set the callback functions for the RTTP engine.

Syntax:

void rt_set_callback(RTEngine engine, socket_event_callback *event_callback, send_data_callback *sendproc);

Parameters:

engine: The pointer to the RTTP engine instance returned by rt_init().

event_callback: A function pointer used to notify the RTTP socket of events.

typedef void socket_event_callback(RTEngine engine, RTSOCKET socket, int event);

Event TypeTypeMeaning
RTTP_EVENT_CONNECTint32RTTP socket connected
RTTP_EVENT_READint32RTTP socket is readable
RTTP_EVENT_WRITEint32RTTP socket is writable
RTTP_EVENT_ERRORint32Error occurred on RTTP socket

sendproc: A function pointer used to send data packets generated by the RTTP engine.

typedef void send_data_callback(RTEngine engine, RTSOCKET socket, const char * buffer, int len, const struct sockaddr* addr, int addr_len);

Return Value:

This function does not return a value.