You copied the Doc URL to your clipboard.

6.1.1. udp_alloc()

This returns a packet large enough for the UDP data. It works by adding the space needed for UDP, IP, and MAC headers to the datalen passed, and calling pk_alloc(). It also ensures that the FREEQ_RESID resource is locked around the call to pk_alloc().

Syntax

PACKET udp_alloc(int datalen, int optlen);

where:

datalen

Is the length of UDP data, not including the UDP header.

optlen

Is the length of IP options, if any. This is typically 0.

Return value

Returns one of the following:

PACKET

A pointer to a packet buffer.

NULL

If a large-enough packet was not available.

When the packet has been successfully transmitted by the hardware, it must be released by calling udp_free(). This is usually done by the sending interface.

Was this page helpful? Yes No