- 论坛徽章:
- 14
|
回复 1# qfmeal
man recv
MSG_DONTWAIT (since Linux 2.2)
Enables nonblocking operation; if the operation would block, the call fails with the error EAGAIN or EWOULDBLOCK
(this can also be enabled using the O_NONBLOCK flag with the F_SETFL fcntl(2)).
flags = 0,应该就是不设置标志位。已经设置为non-block,recv/send也就是non-block
/usr/include/bits/socket.h
- enum
- {
- MSG_OOB = 0x01, /* Process out-of-band data. */
- #define MSG_OOB MSG_OOB
- MSG_PEEK = 0x02, /* Peek at incoming messages. */
- #define MSG_PEEK MSG_PEEK
- MSG_DONTROUTE = 0x04, /* Don't use local routing. */
- #define MSG_DONTROUTE MSG_DONTROUTE
- #ifdef __USE_GNU
- /* DECnet uses a different name. */
- MSG_TRYHARD = MSG_DONTROUTE,
- # define MSG_TRYHARD MSG_DONTROUTE
- #endif
- MSG_CTRUNC = 0x08, /* Control data lost before delivery. */
- #define MSG_CTRUNC MSG_CTRUNC
- MSG_PROXY = 0x10, /* Supply or ask second address. */
- #define MSG_PROXY MSG_PROXY
- MSG_TRUNC = 0x20,
- #define MSG_TRUNC MSG_TRUNC
- MSG_DONTWAIT = 0x40, /* Nonblocking IO. */
- #define MSG_DONTWAIT MSG_DONTWAIT
- MSG_EOR = 0x80, /* End of record. */
- #define MSG_EOR MSG_EOR
- MSG_WAITALL = 0x100, /* Wait for a full request. */
- #define MSG_WAITALL MSG_WAITALL
- MSG_FIN = 0x200,
- #define MSG_FIN MSG_FIN
- MSG_SYN = 0x400,
- #define MSG_SYN MSG_SYN
- MSG_CONFIRM = 0x800, /* Confirm path validity. */
- #define MSG_CONFIRM MSG_CONFIRM
- MSG_RST = 0x1000,
- #define MSG_RST MSG_RST
- MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */
- #define MSG_ERRQUEUE MSG_ERRQUEUE
- MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */
- #define MSG_NOSIGNAL MSG_NOSIGNAL
- MSG_MORE = 0x8000, /* Sender will send more. */
- #define MSG_MORE MSG_MORE
- MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/
- #define MSG_WAITFORONE MSG_WAITFORONE
- MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file
- descriptor received through
- SCM_RIGHTS. */
- #define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
-
复制代码
|
|