This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

On CC3000, trying to decode the end of the Socket Send To HCI message.

I am trying to figure out the Socket Send command, but I can't figure out what the end is...  the following is my breakdown of a valid working command sent from the Stellaris Launchpad using the sample application.  

Socket Command: Socket Send To 192.168.1.84, port 0xC738, message "12345"

U0Vd9jcl.jpg

 

01 00 33 00 00 - SPI Header, HCI Length of 0x33 or 51 decimal
02 - Write Type
83 18 - opcode 0x1883  (wierd, expected 0x1083)
2D 00 - Payload Length? 45 decimal
00 00 00 00 - Socket ID of 0
14 00 00 00 - Arg size =  SOCKET_SENDTO_PARAMS_LEN(24) - Length of Socket ID (4) = 20 = 0x14; Note: SEND (as opposed to SENDTO) uses HCI_CMND_SEND_ARG_LENGTH(16) - Length of SocketID (4)
05 00 00 00 - Message length
00 00 00 00 - flags (all 0s)
0D 00 00 00 - SENDTO Only - Address offset? Calculated from Message Length(5) + (Size of Message Length(4) x 2) = 5 + (4 x 2) = 0x0D
08 00 00 00 - SENDTO Only - Address Length (always 8?  what about ipv6?  eek!) 
31 32 33 34 35 - THE DATA/MESSAGE (ASCII for "12345")
02 00 C7 38 - 0x0002 is family AF_INET (always and type is short), and 0xC738 is the port (SENDTO Only?)
C0 A8 01 54 - Destination IP 192.168.1.84 (SENDTO Only?)
F9 FF FF FF - ??
CB 12 00 20 - ??
00 - Padding byte

 

Any ideas on the red bits?  

 

Thanks. 

  • Hi,

    The last 16 bytes (excluding the padding byte) refer to the destination address.

    This address is defined as:

    typedef struct _sockaddr_t
    {
    unsigned short int sa_family;
    unsigned char sa_data[14];
    } sockaddr;

    where bytes [3,4,5,6] of sa_data represent the destination IP (we only support IPV4) address, and the rest (8 bytes) are actually: sin_zero[8]. It's like a padding structure.

    Regards,

    Tomer

  • Thanks Tomer.  Just the answer I was looking for.  I confirmed that supplying 8 nulls at the end worked just fine.  So, I am going to assume that what I was seeing was just uninitialized values in the array that got sent over with the Sample app. 

    Thanks again.