multiple ports.

seany seany at
Wed Sep 30 11:23:59 UTC 2020


I am trying to use this example for a iot application:

The code i use is:

ushort port               =       5504;

void main(char[][] args)

         auto router = new URLRouter;"/archive", &savedata);
         router.get("/archive", &savedata);

         auto settings = new HTTPServerSettings;
         settings.port = port;
         settings.bindAddresses = ["::1", ""];
         listenHTTP(settings, router);


This is fine. But now that we have ~ 100 IoT devices in the 
field, I would like to assign each a new port. The devices should 
be communicating over HTTP as the vendor software running 
thereupon uses http.

What is the best practice to make a vibe.d server listen to 
multiple ports? Make a loop scanning each loop seems wasteful. Is 
there a function in vibe.d that can take multiple ports, and 
launch a set of threads assigned to each port?

Thank you

More information about the Digitalmars-d-learn mailing list