My code works for the local loopback address "::1". I want to change it so it works for any IPv6 address.
If I set my server IPv6 computer's address as "fd00::1" and I don't set up any IPv6 address for my client can I set up the address structure for my server, like:
Code:
int portNum = 3344;
char *addrIn = "fd00::1";
char *addrOut;
int success = inet_pton(AF_INET6, addrIn, addrOut);
sAddr->sin6_flowinfo = 0;
sAddr->sin6_family = AF_INET6;
sAdr->sin6_addr = addrOut; // Instead of in6addr_any
sAddr->sin6_port = htons(portNum);
And, I can set up my client like:
Code:
struct hostent *server;
char *phostAddr ="fd00::1";
server = gethostbyname2(phostAddr, AF_INET6);
cAddr->sin6_flowinfo = 0;
cAddr->sin6_family = AF_INET6;
memmove((char *) &cAddr>sin6_addr.s6_addr, (char *) server->h_addr, server->h_length)
cAddr->sin6_port = htons(portNum);
I'm mostly interested in whether my client code makes sense and whether or not I need to set up an IPv6 address for my client because my client does not have a GUI for IPv6, but works for the IPv6 loopback address. Also, whether the IPv6 address that I chose for my server would work for Ethernet connection?