vibe.de multiple ports.
karabutaworld at gmail.com
Wed Sep 30 20:10:48 UTC 2020
On Wednesday, 30 September 2020 at 12:38:10 UTC, seany wrote:
> On Wednesday, 30 September 2020 at 12:29:06 UTC, Daniel Kozak
>> Dne st 30. 9. 2020 13:25 uživatel seany via
>> Digitalmars-d-learn < digitalmars-d-learn at puremagic.com>
>>> 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;
>>> router.post("/archive", &savedata);
>>> router.get("/archive", &savedata);
>>> auto settings = new HTTPServerSettings;
>>> settings.port = port;
>>> settings.bindAddresses = ["::1", "0.0.0.0"];
>>> 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.
>> Why? I do not see any reason for that.
> to separate the messages from the IoT responses quickly and
> forward them to different programs, and to have the capability
> in hand, so that when later i have an idea to exploit the
> capability, I can also do it.
What you are doing, if I understand you well, is a way of scaling
the server to handle high amount of traffic.
If that's right, then I'm not sure how the number of PORT is the
issue. Irrespective of the port, the server resources remains the
And if that's the case, then you might need a load balancer (or
use nginx or any of the options I've used in my projects). In
that case, you run multiple versions of the server in stateless
environments... scaled up or down on demand.
Been a long while since I wrote some vibe.d tutorials though :)
More information about the Digitalmars-d-learn