UNP
时间:2007-02-14 来源:ffjnfj
Every TCP and SCTP socket has a send buffer and a receive buffer, and every UDP socket has a receive buffer.
UDP,
当client发送数据包到一个有多个IP的server时,server端使用的时wildcard(*),那么server有可能任意选择一个IP作为replay的地址,而不一定是client端指定的地址,这样client就不能通过IP来判断收到的replay是不是所要的
a successful return from a UDP output operation only means there was room for the resulting IP datagram on the interface output queue
client's ephemeral port is chosen once, on the first sendto, and then it never changes. The client's IP address, however, can change for every UDP datagram that the client sends, assuming the client does not bind a specific IP address to the socket. The reason is shown in Figure 8.11: If the client host is multihomed, the client could alternate between two destinations, one going out the datalink on the left, and the other going out the datalink on the right
有可能这种方法可以确定去特定服务器的Outgoing interface
What happens if the client binds an IP address to its socket, but the kernel decides that an outgoing datagram must be sent out some other datalink? In this case the IP datagram will contain a source IP address that is different from the IP address of the outgoing datalink.
对于UDP,sendto->recvfrom,如果server端断开,sendto会成功返回,但是并不代表已经连上了server,这样再recvfrom时便会永远等下去。此时client会收到一个ICMP错误报告,但是process并不清楚。
加入同一个socket发送了几个datagrams到不同的server,有的server连通,有的没有,那么怎么判断呢?而recvfrom又不能返回该信息。所以就有一个折衷,只有在connect的UDP socket中process才会得到该错误报告.
Linux returns most ICMP "destination unreachable" errors even for unconnected sockets, as long as the SO_BSDCOMPAT socket option is not enabled.
UDP,
当client发送数据包到一个有多个IP的server时,server端使用的时wildcard(*),那么server有可能任意选择一个IP作为replay的地址,而不一定是client端指定的地址,这样client就不能通过IP来判断收到的replay是不是所要的
a successful return from a UDP output operation only means there was room for the resulting IP datagram on the interface output queue
client's ephemeral port is chosen once, on the first sendto, and then it never changes. The client's IP address, however, can change for every UDP datagram that the client sends, assuming the client does not bind a specific IP address to the socket. The reason is shown in Figure 8.11: If the client host is multihomed, the client could alternate between two destinations, one going out the datalink on the left, and the other going out the datalink on the right
有可能这种方法可以确定去特定服务器的Outgoing interface
What happens if the client binds an IP address to its socket, but the kernel decides that an outgoing datagram must be sent out some other datalink? In this case the IP datagram will contain a source IP address that is different from the IP address of the outgoing datalink.
对于UDP,sendto->recvfrom,如果server端断开,sendto会成功返回,但是并不代表已经连上了server,这样再recvfrom时便会永远等下去。此时client会收到一个ICMP错误报告,但是process并不清楚。
加入同一个socket发送了几个datagrams到不同的server,有的server连通,有的没有,那么怎么判断呢?而recvfrom又不能返回该信息。所以就有一个折衷,只有在connect的UDP socket中process才会得到该错误报告.
Linux returns most ICMP "destination unreachable" errors even for unconnected sockets, as long as the SO_BSDCOMPAT socket option is not enabled.
相关阅读 更多 +