<div dir="ltr"><div dir="ltr">On Wed, Sep 30, 2020 at 2:40 PM seany via Digitalmars-d-learn <<a href="mailto:digitalmars-d-learn@puremagic.com">digitalmars-d-learn@puremagic.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wednesday, 30 September 2020 at 12:29:06 UTC, Daniel Kozak <br>
wrote:<br>
<br>
to separate the messages from the IoT responses quickly and <br>
forward them to different programs, and to have the capability in <br>
hand, so that when later i have an idea to exploit the <br>
capability, I can also do it.<br></blockquote><div><br></div><div>Ok as Adam said you can do something like this:</div><div><br></div><div>void main()<br>{<br>   immutable ushort startPort = 5500;<br>    import std.range : iota;<br><br>    foreach (ushort port; iota!(ushort,ushort)(startPort, startPort + 100))<br>       {<br>             auto settings = new HTTPServerSettings;<br>               settings.port = port;<br>         settings.bindAddresses = ["::1", "127.0.0.1"];<br>            listenHTTP(settings, &hello);<br>     }<br>     runApplication();<br>}<br><br>void hello(HTTPServerRequest req, HTTPServerResponse res)<br>{<br>  import std.conv : to;<br> res.writeBody(<a href="http://req.fullURL.port.to">req.fullURL.port.to</a>!string);<br>}<br></div><div><br></div><div> </div></div></div>