sockaddr_in and InternetAddress

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Thu May 28 18:15:25 PDT 2015


I would add it as a new constructor to InternetAddress.

In the mean time, you could work around the lack of it by making 
a new subclass of InternetAddress that sets the member with your 
constructor. Like:

class MyInternetAddress : InternetAddress {
    this(sockaddr_in addr) {
       this.sin = addr;
    }
}


and I think that will work. (Looking at the source, the sin 
member is protected which means a subclass can get at it.)

Then you just pass it everywhere InternetAddress is expected and 
it ought to just work.


More information about the Digitalmars-d mailing list