none
socket error while connecting to a IPv6 server on Windows 7 machine from a IPv4 client RRS feed

  • Question

  • I have a TCP/IP server running on the Windows 7 machine. I call the function getaddrinfo which returns the ::0 address (IPV6_ADDR_ANY). I use the following options while calling this function:

    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_flags = AI_PASSIVE;

    I then bind the socket to a port using this address.

    I also have a TCP/IP client running on Windows Server 2003 machine. When I call the getaddrinfo function on the client passing the hostname of the Windows 7 machine it returns the IPv4 address for the Windows 7 machine running the server. Now when I do a connect call from the TCP/IP client to the Windows 7 machine I get a socket error 10061 which means that the Windows 7 machine actively refused the socket connection. 

    Any clues how to fix this ? The firewall on the Windows 7 machine is turned off.

    In the TCP/IP server if I bind the socket to the IPV4_ADDR_ANY(0.0.0.0) by passing AF_INET in the hints.ai_family then everything works fine. 

    My code is compiled using Visual Studio 2005 on Windows Server 2003 machine.

    Thanks,

    -Nitin

    Wednesday, August 11, 2010 10:48 AM

All replies

  • You need to change the protection level on the ipv6 socket to accept connection on global adddresses. Change the protection level to unrestricted. Check the below link for details..

    http://msdn.microsoft.com/en-us/library/aa916826.aspx

    Wednesday, August 25, 2010 7:39 AM