LogicReinc / LogicReinc.BlendFarm

A stand-alone Blender Network Renderer
GNU General Public License v3.0
414 stars 35 forks source link

Listen on all interface #37

Closed nephaste closed 1 year ago

nephaste commented 2 years ago

Hi and thanks for this application

trying to make run server Linux version on a Qnap NAS to build a package

but look like it listens on the first interface only (actually my docker binding)... how make it listens on all Network interface

image

thanks for your help

LogicReinc commented 2 years ago

Hey nephaste, The server already listens to all interfaces, note that Docker are containers, and you need to explicitly expose the port to access the server. Also note that the "Server" is a Render Node. A NAS doesn't tend to have much compute at all, so you may have misunderstood the use of the Server. BlendFarm works from the client (sort of peer2peer). Meaning you don't need to host an actual central server to organize your computers. You just need to run the LogicReinc.BlendFarm.Server on every computer you want to use for rendering (except the client computer as it runs the server on its own).

nephaste commented 2 years ago

Hi thanks a lot for your answer

indeed it is non sense to run it within a Celeron NAS, but Qnap has strong solutions like Core Intel / AMD Ryzen, or Xeon and AMD EPIC ... more over some customers can add NVIDIA GPU inside... and genrally they have severals servers in their LAN conencted in 10Gbe

I was thinking it was intersting to bring them the server solution as a third part QPKG community

on my screenshot dont know why it binds to my docker0 adapter ...and server display it as host adress

it shouldn't display 0.0.0.0 instead ?

LogicReinc commented 2 years ago

I don't believe it will list localhost, but it will work fine. Internally the client will also use localhost (or 127.0.0.1 specifically to prevent issues on Linux) to connect to itself as well. As I mentioned, I think it makes sense that it will only show the docker ip because thats the address the container has access to. To provide the ip/port externally you need to use EXPOSE {port}/tcp as far as I know. If the container supposedly has access to more ips, they might not be labeled as InterNetwork and instead are visible as external ips (however Docker labels it). Those IPs are just a result from the following query:

string[] addresses = Dns.GetHostEntry(Dns.GetHostName()).AddressList
                    .Where(x => x.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                    .Select(x => x?.ToString())
                    .ToArray();

Either way, the ips it lists are not particularily important. Those are just aids to see your computer ip. The actual application doesn't listen to specific ips but listens to all interfaces. As can be seen in the source, The UDP listener (for broadcasting) binds to:

ListenerUDP.Client.Bind(new IPEndPoint(IPAddress.Any, BroadcastPort));

And the TCP listener (for actual communication) binds to the same:

Listener = new TcpListener(IPAddress.Any, Port);

The only issue you might encounter is that broadcast detection will not work (it has some issues on its own seeing how it only uses the first InterNetwork address, while a lot of computers have multiple). This does not impede functionality, just that you have to manually add the node by ip.