Getting the NetworkInterface for "0.0.0.0" (all)

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

But if you want to write your own Server/Console App and specify the “0.0.0.0” 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
NEXT i

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 (0.0.0.0) 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 “0.0.0.0” by re-setting it to “NIL”