sockaddr_in and InternetAddress

Andre Kostur via Digitalmars-d digitalmars-d at puremagic.com
Thu May 28 17:08:02 PDT 2015


I'm looking for one of two things:

1) If I have a sockaddr_in, how do I get it into an 
InternetAddress?   I can do it with sufficient handwaving using 
bigEndianToNative and such (pulling out the 4-byte address in 
there), but I was expecting an easier/shorter method to get the 
sockaddr_in into an InternetAddress (after all, it's exactly what 
an InternetAddress is holding internally anyway)?

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?)

And... a similar issue for sockaddr_in6 and Internet6Address 
(although this one's easier since you don't need to deal with the 
endianness issue).


More information about the Digitalmars-d mailing list