- 论坛徽章:
- 0
|
今天是周日,可能大家都没空吧。
我觉得是跟C语言的recv和send参数一样的吧。
测试一把就知道了- The flags argument to a recv call is formed by OR'ing one or more of the following values:
- MSG_OOB
- This flag requests receipt of out-of-band data that would not be received in the normal data stream. Some protocols place expedited data at the head of the normal data queue, and thus this flag cannot be used with such protocols.
- MSG_PEEK
- This flag causes the receive operation to return data from the beginning of the receive queue without removing that data from the queue. Thus, a subsequent receive call will return the same data.
- MSG_WAITALL
- This flag requests that the operation block until the full request is satisfied. However, the call may still return less data than requested if a signal is caught, an error or disconnect occurs, or the next data to be received is of a different type than that returned.
- MSG_TRUNC
- Return the real length of the packet, even when it was longer than the passed buffer. Only valid for packet sockets.
- MSG_ERRQUEUE
- This flag specifies that queued errors should be received from the socket error queue. The error is passed in an ancillary message with a type dependent on the protocol (for IPv4 IP_RECVERR). The user should supply a buffer of sufficient size. See cmsg(3) and ip(7) for more information. The payload of the original packet that caused the error is passed as normal data via msg_iovec. The original destination address of the datagram that caused the error is supplied via msg_name.
- For local errors, no address is passed (this can be checked with the cmsg_len member of the cmsghdr). For error receives, the MSG_ERRQUEUE is set in the msghdr. After an error has been passed, the pending socket error is regenerated based on the next queued error and will be passed on the next socket operation.
- The error is supplied in a sock_extended_err structure:
复制代码 |
|