no route to host with ipv6?
no route to host with ipv6?
- Subject: no route to host with ipv6?
- From: email@hidden (Sebastian Mecklenburg)
- Date: Tue, 17 Jun 2003 14:20:11 +0200
hello,
i wrote a simple client-server software in c++ and the usual unix
socket functions to transfer some data via tcp. it works fine with ipv4
but with ipv6 the connect() function always generates a "no rout to
host" error, if server and client are on different computers. if both
are on the same machine (i.e. both use ::1 as address) it works fine.
here is the code i use, it's the constructor of mysocket class:
//create a client
Socket::Socket(const char* in_hostname, const char* in_portnumber) :
m_socketDescriptor(-1),
m_isServer(false) {
int err = 0;
struct addrinfo hints, *res;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0; //AI_PASSIVE (not for clients)
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
err = ::getaddrinfo(in_hostname, in_portnumber, &hints, &res);
//no error here
m_socketDescriptor = ::socket(res->ai_family, res->ai_socktype,
res->ai_protocol);
if(m_socketDescriptor < 0) {
//no error here
}
// Connect to the server
err = ::connect(m_socketDescriptor, res->ai_addr, res->ai_addrlen);
//duh! err is -1 and errno is 65, which stands for "no route to host'"
}
for in_hostname parameter i use the ipv6 ip address of the server,
which is automatically generated from the MAC address of the network
devices and is shown by ifconfig, for example fe80::230:65ff:fe17:8f20.
someone got an idea?
regards,
sebastian mecklenburg
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.