[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 02365) Re: IPv6 replcement for sendto() ?
You can just use 'to' by casting sockaddr_storage structure.
(sockaddr_in{} is small for IPv6 address.)
getaddrinfo()-send*() combination is more useful.
(It can conceal IP version.)
struct addrinfo hints, *res, *res0;
getaddrinfo(host, service, &hints, &res0);
...
for (res=res0; res; res = res->ai_next) {
s = socket(res->ai_family, res->ai_socktype,
res->ai_protocol);
...
sendto(s, buf, n, 0, res->ai_addr, res->ai_addrlen);
....
}
At Tue, 13 May 2003 16:20:32 +0200,
Yaniv Kaul <ykaul@xxxxxxxxxxxxxx> wrote:
>
> I'm trying to port an application to IPv6.
> What is the IPv6 'sendto' function?
> I'm especially stuck with the 5th parameter of the sendto() function - *to :
>
> int sendto(int s, const void *msg, size_t len, int flags, const struct
> sockaddr *to, socklen_t tolen);
>
> Could it be sendmsg() ? I was hoping for sendto6() or something ;-)
>