fail to connect using BSD socket api on IPV6 only network in iOS, if does not bind specific ineterface local address.

my client application always fail to connect using BSD socket api on ipv6-only network in iOS.

bsd socket api connect fuction always return failure with 65(no route to host)

but if bind socket using specific interface address(en0/ipv6), always succeed to connect.

fail case :

  1. try to connect without binding.

  2. try to connect after binding using "::" , "0:0:0:0:0:0:0":

success case:

  1. try to connect after biding using (en0/ipv6) local address (ex 2404:xxxx:fce:4551:xxxx:79c7:xxxx:xxxx)

Does anyone know fail to connect on ipv6 only in iOS if does not bind specific interface local address.

Does anyone know fail to connect on ipv6 only in iOS if does not bind specific interface local address.

If you are using a local address then you will need to scope the address to an interface with something like ff02::1%en0.

Having said that, instead of using BSD sockets why not try using nw_connection_t or NWConnection as this API attempts to resolve these specific types of issues that you are dealing with.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
fail to connect using BSD socket api on IPV6 only network in iOS, if does not bind specific ineterface local address.
 
 
Q