Tubetrue01 / articles

0 stars 0 forks source link

Socket(一)recv 与 send 函数 | Tubetrue01 #9

Open Tubetrue01 opened 2 years ago

Tubetrue01 commented 2 years ago

https://tubetrue01.github.io/articles/2021/08/16/c_unix/Socket(%E4%B8%80)recv%E4%B8%8Esend%E5%87%BD%E6%95%B0/

引言 不论客户端还是服务端,都用 send 函数向对端发送数据。对于客户端来说,用 send 发送请求,对于服务端来说,用 send 发送响应。同时,她们都用 recv 函数从对端接收数据。 1. 函数声明123456#include <sys/socket.h>ssize_t recv(int sockfd, void *buff, size_t nbytes, int flags