linux C语言 send sendto recv recvfrom 的等价写法

在linux中

send(s, buf, len, flags) 与 sendto(s, buf, len, flags, NULL, 0) 等价吗?

recv(s, buf, len, flags) 与 recvfrom(s, buf, len, flags, NULL, 0) 等价吗?

等价的。直接用read,write往buffer里写也是可以的

不等价,sendto与recvfrom要地址参数,面向无连接,只要地址就可以发送。
send与recv 是面向连接的,因此使用前需要握手,握手成功后已经跟套接字绑定,因此不需要再需要地址参数

不等价。send和recv用于tcp连接,剩下的用于udp连接。