Introduction
80
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
Socket
6.1
Introduction
Sockets allow the communication between two or more peers in the network. The SimpleLink device
complies with the BSD, which is a common IP connection interface in the industry. This chapter describes
the socket layer of the SimpleLink device. The socket layer provides a set of simple API for sending and
receiving data. The SimpleLink device implements a subset of the BSD API which complies with the Linux
variant.
6.2
Key Features
lists the key features of the socket.
Table 6-1. Key Features
Key Features
Description
Max Sockets
16 sockets including up to 6 connected secured sockets
Socket Types
SL_SOCK_STREAM (TCP)
SL_SOCK_DGRAM (UDP)
SL_SOCK_RAW
SL_IPPROTO_TCP (TCP RAW socket)
SL_IPPROTO_UDP (UDP RAW socket)
SL_IPPROTO_RAW (IP RAW socket)
SL_SEC_SOCKET (secure socket – SSL/TLS)
Address Families
SL_AF_INET (IPv4)
SL_AF_INET6 (IPv6)
SL_AF_RF (transceiver)
SL_AF_PACKET
Connection Types
Client
Server
Modes
Blocking
Non-blocking
Trigger
Dual Stack Mode
IPv6 server allows IPv4 client connections.
UDP Packet Boundary
Enable and disable (disable by default)
Select
Select on receive, accept, and connect
GetHostByName
Retrieve the IPv4/IPv6 address according to the host name.
Multicast
Up to eight Multicast sockets
6.3
Socket Types
The socket layer of the SimpleLink device supports the following socket types:
•
UDP
sockets provide users a basic transport service, with no guarantee of delivery and packet
ordering. UDP also allows more than two hosts to exchange data through a multicast group.
•
TCP
sockets enable two hosts to establish a connection and exchange streams of data with a
guarantee of delivery and packet ordering.
•
RAW
sockets provide users access to the underlying communication protocols with socket
abstractions. RAW sockets are datagram oriented (packet boundary). The SimpleLink device allows
RAW sockets to the following layers:
–
Layer 1: Physical (available only if the device is not connected to a wireless network).
–
Layer 2: Data Link (MAC)
–
Layer 3: Network
–
Layer 4: Transport