[ WiFi 智能家居项目 ] [ 8 ] WiFi TCP 编程

TCP client VS DUP client



TCPUDP
socket typeSOCK_STREAM
Provides sequenced, reliable, two-way, connection-based byte  streams.  An out-of-band data transmission mechanism may be supported.
SOCK_DGRAM
Supports datagrams (connectionless, unreliable messages of a fixed maximum length).
connect()×


TCP server VS UDP server


TCPUDP
listen
listen() marks the socket referred to by sockfd as a passive socket, that is, as a socket that will be used to accept incoming connection requests using accept.
×
accept√ 
该函数不会阻塞,需借助 while 检查连接是否建立。连接建立后,返回新的文件描述符;传入地址是客户端地址。
×