Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I let the user decide to what networkinterface he/she wanted to connect to and placed that in an AppSetting. Then I create a module that reads the config file to decide what networkinterface to connect to, and to check and get the IPAddress I use this code</p> <p>in vb.net:</p> <pre><code> Dim networkinterfaces() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces() Dim found As Boolean = False For Each ni As NetworkInterface In networkinterfaces If NetworkInterfaceName.Equals(ni.Name) Then If ni.GetPhysicalAddress().ToString().Length &gt; 0 Then IPAddressFromNetworkCard = ni.GetIPProperties.UnicastAddresses(0).Address found = True Exit For End If End If Next </code></pre> <p>in c# (some more tracing, but it almost does the same):</p> <pre><code>Console.WriteLine("Test get ip of interfacecard"); Console.WriteLine("Give name of interfacecard:"); string s = Console.ReadLine(); List&lt;NetworkInterface&gt; nics = NetworkInterface.GetAllNetworkInterfaces().ToList&lt;NetworkInterface&gt;(); Console.WriteLine(nics.Count + " networkinterfaces found"); bool found = false; foreach (NetworkInterface ni in nics) { Console.WriteLine("Available nic: " + ni.Name); } Console.WriteLine(""); Console.WriteLine(String.Format("searching for: \"{0}\"", s)); foreach (NetworkInterface ni in nics) { if (ni.Name.Equals(s)) { if (ni.GetPhysicalAddress().ToString().Length &gt; 0) { Console.WriteLine("Network interface found, ipAddress: " + ni.GetIPProperties().UnicastAddresses[0].Address.ToString()); found = true; break; } } } if (!found) Console.WriteLine(String.Format("\"{0}\" not found", s)); Console.ReadKey(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload