Network IPAddress.Any

Wifi tests going great :grinning:

Does IPAddress.Any return the module IP address ?

** Why am I not using a Click ?

  1. Wanted to create my building blocks – if I end up creating a PCB with SITCore and WiFi onboard
  2. Have not routed a PCB or soldered in a long time and wanted to have some fun :wink:

mmmm, purple…

IPAddress.Any is used in the context of binding an endpoint to a socket:

            ep = new IPEndPoint(IPAddress.Any,;

This allows you to take a connection from any IP address on a specified port.

To get the IP address of whatever is connected, after you accept the connection, you can get the endpoint, which contains the connection information.

                clientSocket = serverSocket.Accept();
1 Like

Thanks Phil.

I believe that the use is “Provides an IP address that indicates that the server must listen for client activity on all network interfaces”

On my test last night the IP was, however I was not able to connect from the client until I hardcoded the IP address.

I will run another test later today and check for my mistakes.

It seems there might be a little confusion here. You have to specify an IP address for the interface itself when you create it:

        networkInterfaceSetting.Address = new IPAddress(;

In this step, you must assign an address or get one from DHCP.
IPAddress.Any is no good here. After that, you have to create and bind a socket to the interface to listen for connections:

            serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            //bind socket to all available endpoints (should only be the ethernet on the board)

            ep = new IPEndPoint(IPAddress.Any,;

As you note, in this step, you are telling your interface (to which you have assigned an IP, or gotten one for DHCP) what IP address(es) to listen to for a connection. Specifying IPAddress.Any() here means your client can have any IP address.

Issue was related to my router - the board was on my guest network and the PC on another :slight_smile:

Working good once I changed the connection parameters.