日期:2014-05-16  浏览次数:20654 次

send与recv标志参数什么意思?
send(fds[i], msg, strlen(msg), MSG_NOSIGNAL);//MSG_NOSIGNAL什么意思?
 recv(sd, buf, sizeof(buf), 0);//0代表什么意思?

------解决方案--------------------
From man page:
MSG_OOB
Sends out-of-band data on sockets that support this notion (e.g. of type SOCK_STREAM); the underlying protocol must also support out-of-band data.
MSG_EOR
Terminates a record (when this notion is supported, as for sockets of type SOCK_SEQPACKET).
MSG_DONTROUTE
Don't use a gateway to send out the packet, only send to hosts on directly connected networks. This is usually used only by diagnostic or routing programs. This is only defined for protocol families that route; packet sockets don't.
MSG_DONTWAIT
Enables non-blocking operation; if the operation would block, EAGAIN is returned (this can also be enabled using the O_NONBLOCK with the F_SETFL fcntl(2)).
MSG_NOSIGNAL
Requests not to send SIGPIPE on errors on stream oriented sockets when the other end breaks the connection. The EPIPE error is still returned.
MSG_CONFIRM (Linux 2.3+ only)
Tell the link layer that forward progress happened: you got a successful reply from the other side. If the link layer doesn't get this it'll regularly reprobe the neighbour (e.g. via a unicast ARP). Only valid on SOCK_DGRAM and SOCK_RAW sockets and currently only implemented for IPv4 and IPv6. See arp(7) for details.