On Sunday, 5 December 2021 at 16:24:34 UTC, Chris Katko wrote:

I know there "is" a solution, it's just so odd to have this much difficulty using a string.

Paying attention to the online docs would help you too ;-)

https://dlang.org/library/std/socket/internet_address.this.html

But, in the event you do 'need' to work with strings, you can just convert the string to ushort.


// ---
module test;

import std.stdio : writeln;
import std.socket : InternetAddress;
import std.conv : to;

void main()
{
    string host = "localhost";
    string port = "8080";

    auto ia = new InternetAddress(host, to!ushort(port));

    writeln(ia);
}

//-----------

Reply via email to