Re: UDP question.



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/



Relevant Pages

  • Re: How to know if a network adapter is connected
    ... but for the adapter that received the packet. ... with the IP Helper API and bind each socket to one adapter. ... So if i power on my application before having connected the network card, ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: How to know if a network adapter is connected
    ... when the packet is received (don't need to bind). ... If someone is connecting ... should respond with different content dependent on the network (adapter) ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: UDP question.
    ... >> My two adapters has two different IP address, and I bind one IP ... >> do you mean that I alloc two socket and bind different IP is not ... > sending a packet *to* 1.2.4.5, it will go out the first interface. ... not real bind the adapter? ...
    (Linux-Kernel)
  • Re: How to know if a network adapter is connected
    ... This is the only way I know to identify the network adapter, ... Yes i agree but if the adapter is not connected to the network, the bind() function return SOCKET_ERROR. ... So i need to bind every socket each time i call the recv ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: socket send help
    ... That's true for hardware firewalls ... merely hook socket calls", I still don't see failing a bind() to INADDR_ANY while allowing a bindto 127.0.0.1. ... If some physical network adapter should be unavailable while the loopback is allowed, fine; passing INADDR_ANY should work and bind to the loopback adapter. ... The time to bindto localhost is when we specifically do not want to be available on an external network adapter. ...
    (comp.lang.python)