On Friday, 29 May 2015 at 00:08:10 UTC, Andre Kostur wrote:
I'm looking for one of two things:

1) If I have a sockaddr_in, how do I get it into an InternetAddress?

First of all, you may not actually need an InternetAddress. Modern code working with addresses should be address-agnostic, so it should take an Address instead. Ideally, you should avoid doing anything address-family-specific - then, it will work with any address family, incl. any introduced in the future.

You could:

- Create an UnknownAddressReference which uses a pointer to your sockaddr_in.

- Create an InternetAddress, then copy the address over its "name" property.

2) If it is agreed that there should be a shorter way, I'm willing to write the code, but would need a little guidance as to where would be the appropriate place to put the code (New overload to parseAddress? New constructor for InternetAddress?)

A new constructor for InternetAddress won't hurt.

Reply via email to