Re: UDP question.

From: Sven-Haegar Koch
Date: Thu Sep 14 2006 - 19:33:12 EST


On Fri, 15 Sep 2006, xixi lii wrote:

This result can't satisfy me, so I add another network adapter, and
try the code blow:

//////
socket1 = socket(AF_INET, SOCK_DGRAM, .....)
socket2 = socket(AF_INET, SOCK_DGRAM, .....)
bind socket1.network adapter1...
bind socket2 network adapter2
time = time(NULL);
while (1)
{
sendto(socket1, "", 1, 0, dstaddr1, addrlen);
sendto(socket2, "", 1, 0, dstaddr2, addrlen);
count += 2;
}
time = time(NULL) - time;
avg = count / time;
///////////////////

But I get the result is also 75000 packet per second, WHY?


It look like that when send a packet to bond dev, bond use current
slave and send packet, then change current slave to next. What is the
essence different between the bond and my code (use two network
adapters)?

Any suggestions?

I am not really sure, but I think the bind to an adapter under linux only chooses the source ip, not really the adapter used to send the packets.

Did you check that the two destination ips have routes through different interfaces, and not go out through the same one?

(You should even be able to verify this with tcpdump, if you get packets on one interface and nothing on the second)

c'ya
sven

--

The Internet treats censorship as a routing problem, and routes around it.
(John Gilmore on http://www.cygnus.com/~gnu/)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/