Skip to main content

rt_incoming_packet

Description

The rt_incoming_packet function inputs a data packet into the RTTP engine. RTTP itself does not send or receive data, which allows RTTP to be independent of the socket IO framework and easy to integrate.

Syntax:

RTSOCKET rt_incoming_packet(RTEngine engine, const char * buffer, int len, const struct sockaddr *from, int from_len);

Parameters:

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

buffer: A pointer to the buffer containing the data.

len: The length of the data in bytes.

from: The address from which the incoming packet originated.

fromlen: The length of the address in bytes.

Return Value:

When a new RTTP client connects, it returns the RTTP socket descriptor of the new connection. If the application accepts this connection, it needs to call the rt_accept function; if it rejects the connection, it needs to call the rt_close function to close this socket. In other cases, this function returns NULL.