I think that a program using sockets can’t bind itself to the loopback address because System.GetNetworkInterface() does not return the loopback interface as an available NetworkInterface.
My goal is to write a program “binded” only to the loopback network.
This program can be accessed by a network interface by means of a tunneling program.
This scenario is reported in the NetworkInterface documentation as follows:
“Multiple network interfaces are supported for Windows, OS X, and Linux. This allows you to write applications that can bind to different network interface cards on a user’s machine. You can use this to write tunneling applications, for example.”
With the above description and supposing that I’m missing something related to sockets properties in Xojo how can I write a program that can bind only to the loopback network?
I think there should be a special NetworkInterface object for localhost.
On windows you can install the Microsoft Loopback adaptor and then bind to it.
Thank you both Christian and Lee.
I think that the NetworkInterface object is “masking” something that is available in many other languages i.e. the network address to bind to a socket.
So, my opinion, would be useful to have in Xojo a “virtual network interface” for the loopback address.
I think the feature request is clear. RS can just write a little helper function to return a Networkinteface for localhost.
like this unworking code:
Function Localhost() As NetworkInterface
dim n as new NetworkInterface
n.IPAddress = “127.0.0.1”
and than on bind/connect use the localhost interface.
Exactly, would be great to have a NetworkInterface modifiable or more flexible.
Some others great features related to the network for standalone Web apps:
- the application can select the port when started (now can be specified only as a command line option)
- the application can select the NetworkInterface (now can’t be done)
Feature requests #31786 (loopback network) and #31788 (web application).