0
Answer

Network, multi Interface, socket

p df

p df

16y
2.2k
1
Hello,

I have, on a PC, two Network Adapters.
I need to test the quality of these interfaces, with a cross link.
I have written a small program in C# with a client socket and a server socket.
But I want to be sure that exchange is going on the cable, and NOT inside the network layers of the PC.
So I want to bind the client socket and the server socket each to one of the interfaces.

The function I want to use is in the following code :

Socket     xPortSend;
//...
byte[] AdapterId = ????
int iRet = xPortSend.IOControl( IOControlCode.BindToInterface, AdapterId, null );

1) I don't know how to find the Adapter Id of each network interface ?
2) The parameter need to be a byte[] array  : how to convert ?
2) Which is the exact synthax to use with the function "IOControl" in this specific case (there are on the net only samples for RecevAll value) ?

Some samples on this call will be very helpfull ?

Best regards.