TCPSocket
TCP socket is an API endpoint for network communication that uses the Transmission Control Protocol (TCP). A TCP socket is identified by a local IP address and port, and by the remote endpoint after a connection is established. Applications typically create a socket with an address family of AF_INET or AF_INET6 and a socket type of SOCK_STREAM.
In practice, a server creates a passive listener by binding to a local address and port, then
TCP provides reliable, in-order delivery with error detection, acknowledgments, and retransmission. It also implements flow control
Sockets can operate in blocking or non-blocking modes and are usable in synchronous or asynchronous I/O models.
Common considerations include performance tuning (such as Nagle’s algorithm and buffering), handling partial reads or writes,