flag 안쓰면(NULL) 둘 다 거의 동일하다 라고 보면 될 듯.
The only difference between recv() and read(2) is the presence of flags. With a zero flags argument, recv() is generally equivalent to read(2) (but see NOTES). Also, the following call recv(sockfd, buf, len, flags); is equivalent to recvfrom(sockfd, buf, len, flags, NULL, NULL); NOTES If a zero-length datagram is pending, read(2) and recv() with a flags argument of zero provide different behavior. In this circumstance, read(2) has no effect (the datagram remains pending), while recv() con‐ sumes the pending datagram. The socklen_t type was invented by POSIX. See also accept(2). According to POSIX.1, the msg_controllen field of the msghdr structure should be typed as socklen_t, and the msg_iovlen field should be typed as int, but glibc currently types both as size_t. See recvmmsg(2) for information about a Linux-specific system call that can be used to receive multiple datagrams in a single call. |
[링크 : https://linux.die.net/man/2/recv]
'Linux API > network' 카테고리의 다른 글
bind(): Address already in use (0) | 2023.07.21 |
---|---|
AF_PACKET로 link layer 열기 (0) | 2022.06.09 |
linux tcp server listen accept connect (0) | 2022.05.11 |
ssl socket 예제 (0) | 2022.03.25 |
TCP timeout (0) | 2020.09.29 |