Getting the NetworkInterface for "" (all)

You can start a WebApp with the parameter: “–NetworkInterfaceIndex=”

But if you want to write your own Server/Console App and specify the “” Interface on the command line, how to do this?

This code lists only the loopback and the network interfaces:

PRINT System.NetworkInterface.Loopback.IPAddress

FOR i AS Integer = 0 TO System.NetworkInterfaceCount - 1
PRINT System.NetworkInterface( i ).IPAddress

I think, the “all interfaces” Network Interface should be available like the “System.NetworkInterface.Loopback.IPAddress” - or have I missed something?

Don’t specify a network interface.

Remember though that web apps user a ServerSocket, not just a plain socket.

1 Like

Thank you Greg - you gave me the right idea!

s = NEW MyOwnServerDerivedFromTCPSocket

DIM all AS NetworkInterface = s.NetworkInterface // get the default ( Network Interface (it is just NIL)
s.NetworkInterface = System.NetworkInterface.Loopback // set it to something else
s.NetworkInterface = all // change mind and go back to “” by re-setting it to “NIL”