Socket Working Flow
82
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
Socket
}
/* Send using SimpleLink API and checking the return value */
Status = sl_Send(sock , pBuff,
sizeof
(pBuff), 0);
if
( Status < 0)
{
printf(
"send() failed\n"
);
if
(Status == ...) { ... }
}
6.5
Socket Working Flow
Two main categories of sockets exist: datagram sockets (connectionless) and stream sockets (connection
oriented). Datagram sockets or connectionless sockets allow for data exchange between entities without
establishing a connection before any data delivery. In this category the data integrity and packet order are
not ensured.
Stream sockets or connection-oriented sockets require establishing a connection between the two entities
before any data exchange. While the connection is maintained, data integrity and the order are ensured.
Programmers should choose between connection-oriented transport protocol and connectionless transport
protocol according to the requirements of their applications. For example, VoIP applications, which are
sensitive to delays, may require the connectionless transport protocols. File transfer applications may
require connection-oriented transport protocol due to the guaranty of data integrity and packet ordering.
6.5.1 TCP
TCP is a connection-oriented transport protocol. The TCP client initiates the connection to a TCP server,
and after establishing the connection successfully, the socket provides a bidirectional tunnel between the
client and the server.
describes the general flow of TCP between a server and a client.