3 Replies Latest reply on Feb 20, 2015 10:02 AM by seyhan

    UDP stream API

    feng@ibiquity.com

      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

        • 1. Re: UDP stream API
          seyhan

          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

          • 2. Re: UDP stream API
            feng@ibiquity.com

            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

            • 3. Re: UDP stream API
              seyhan

              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