UDP stream API

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

We are using WICED_SDK_3.1.2. Is there any UDP stream API like wiced_tcp_stream_write()? In addition, what is max udp packet length in wiced_packet_create_udp() or that can be sent?

Thanks in advance

0 Likes
3 Replies
SeyhanA_31
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hi,

The functions start with wiced_udp_... in wiced_tcpip.h are related to UDP. For UDP packet send wiced_udp_send(...) cpuld be used.

For wiced_packet_create_udp(...) see the comments on function definition.

/** Allocates a UDP packet from the pool

*

*  Allocates a UDP packet from the main packet pool.

*

*  @note: Packets are fixed size. and applications must be very careful

*        to avoid writing past the end of the packet buffer.

*        The available_space parameter should be used for this.

*

* @param[in,out] socket          : An open UDP socket for which the packet should be created

* @param[in]    content_length  : the intended length of UDP content if known.

*                                  (This can be adjusted at a later point with @ref wiced_packet_set_data_end if not known)

* @param[out]    packet          : Pointer to a packet handle which will receive the allocated packet

* @param[out]    data            : Pointer pointer which will receive the data pointer for the packet. This is where

*                                  UDP data should be written

* @param[out]    available_space : pointer to a variable which will receive the space

*                                  available for UDP data in the packet in bytes

*

* @return @ref wiced_result_t

*/

wiced_result_t wiced_packet_create_udp( wiced_udp_socket_t* socket, uint16_t content_length, wiced_packet_t** packet, uint8_t** data, uint16_t* available_space );

The content_length is unused by the above function. Requested packet is returned from the packet pool and the available_space indicates the size of the memory available for data in the packet.

Seyhan

0 Likes
Anonymous
Not applicable

Hi,

Both wiced_packet_create_udp() and wiced_udp_send() are for regular UDP API, not UDP stream API like wiced_tcp_stream_write(). We can put 10k bytes of data into wiced_tcp_stream_write(), for regular udp api, I can only put max 1460 bytes of data. For our audio streaming application, we must send much bigger packets like 10k bytes.

Thanks

0 Likes

Hi,

That is the size of the packet pool defined for the network stack. Similar to wiced_tcp_stream_write(...) for UDP is not available yet. But feel free to copy the wiced_tcp_stream_write(...) and use the logic to for udp streaming for your application.

The 10K data needs to chucked up and sent out as the UDP packets are available.

Seyhan

0 Likes