Click to See Complete Forum and Search --> : Communicating between two NICs on the same PC


Tomcat
December 27th, 2004, 08:32 AM
This may not strictly be a programming problem, but I hope someone can point me in the right direction anyway.

I'm trying to test the performance of a switch using a single PC with two NICs, by sending data on one NIC and receiving it on the other. My problem is that I can't get W2K to send the data on the NIC - it passes it to the receiver internally.

My setup:
NIC 1: 192.168.0.1 ----- Switch (port 1)
NIC 2: 192.168.0.2 ----- Switch (port 2)

The server app binds the TCP listen socket to 192.168.0.1.
The client app binds its socket to 192.168.0.2 and then connects to 192.168.0.1.

(HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter is set to 0)

Everything looks fine except that I can send ~100 Mbps (the speed of the NIC) even when the switch has been turned off. :confused:

Does anyone have any ideas what else I can do, programmatically or otherwise?

*Added*
The socket option SO_USELOOPBACK looked like a possible solution, but it apparently doesn't work in any Windows version (WSAENOPROTOOPT). :(

Mathew Joy
December 29th, 2004, 01:25 PM
So what is the problem? You wan't more speed or less speed. If both the client and server is always in the same machine, I think communicating via LPC is more efficient.

Tomcat
December 29th, 2004, 01:45 PM
Like I said, I'm trying to test the performance of a switch (or rather: lots of switches). I can't do that if the traffic is looped internally.

It can be done like this:
PC1 (client) --> switch --> PC2 (server)

What I'm trying to find is a solution that only needs one computer.

Mathew Joy
December 30th, 2004, 01:23 PM
Ahhh.. I doubt whether it can be done. There is an option to disable loopback in multicast using the socket opt IP_MULTICAST_LOOP, that too is for a single card.