SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
RAW sockets in layer 4 let the host application send and receive packets, which include the IP header. Opening a RAW socket with TCP or UDP protocol means that all packets are forwarded directly to the RAW socket. If any other TCP/UDP socket is open, it does not receive any packets. RAW sockets can work with any desired protocol, which should be specified when opening the socket.
By default all received packets include the IP header. If the IP header of the packet is not needed, it can be removed by calling the API sl_SetSockOpt with the option SL_IP_RAW_RX_NO_HEADER.
Example:
#define MY_PROTOCOL 90
_i16 Sd, Protocol = MY_PROTOCOL;
Sd = sl_Socket(SL_AF_INET /* SL_AF_INET6 */, SL_SOCK_RAW, Protocol);
if( 0 > Sd )
{
// error
}