Rob <[email protected]> writes: >Uwe Klein <[email protected]> wrote: >>> However, what I don't understand is why an IPv6 address does not fit >>> into a struct sockaddr, and why this fact is so badly documented. >>> It took me a lot of time to find why my queried IPv6 addresses were >>> truncated. >> >> struct sockaddr was a catch all and you had to also hand the size of the >> storage into the call. >> >> forex: >> int getpeername(int s, struct sockaddr *name, socklen_t *namelen);
>Yes, that is what I mean. But it no longer works. Of course it still works; however, you may have missed that "struct sockaddr" isn't the same as "struct sockaddr_in"; these days you'd start with a "struct sockaddr_storage" and with socklen_t namelen = sizeof (struct sockaddr_in) On return you'd determine what type of connection you got and you cast it to the proper type. Casper _______________________________________________ questions mailing list [email protected] http://lists.ntp.org/listinfo/questions
