The man page for getaddrinfo implies that

>         error = getaddrinfo(“www.myserver.com:12345 
> <http://www.myserver.com:12345/>", "http", &hints, &res0);

should rather be

>         error = getaddrinfo(“www.myserver.com 
> <http://www.myserver.com:12345/>", “12345", &hints, &res0);


James R. Cutler
james.cut...@consultant.com
PGP keys at http://pgp.mit.edu



> On Jan 16, 2018, at 3:50 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
> wrote:
> 
> 
>> On Jan 16, 2018, at 1:22 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> 
>>> On Jan 16, 2018, at 11:05 AM, Jens Alfke <j...@mooseyard.com 
>>> <mailto:j...@mooseyard.com>> wrote:
>>> 
>>>> On Jan 16, 2018, at 2:11 AM, Quinn The Eskimo! <eski...@apple.com 
>>>> <mailto:eski...@apple.com>> wrote:
>>>> 
>>>> The fact you’re using a legacy API like this implies that you’re not 
>>>> IPv6-compatible.  To can learn more about this is my “Supporting IPv6-only 
>>>> Networks” pinned post on DevForums.
>>>> 
>>>> <https://forums.developer.apple.com/message/136166#136166 
>>>> <https://forums.developer.apple.com/message/136166#136166>>
>>> 
>>> According to Stuart Cheshire(?)’s talk at a recent WWDC, some cell carriers 
>>> have switched their data networks over to IPV6-_only_. This may be the 
>>> cause of the problem. Even if gethostbyname is able to retrieve an IPv4 
>>> address for your server, your device would be unable to send packets to it 
>>> because there’s no IPv4 router upstream.
>> 
>> Jens, Quinn,
>> 
>> I have verified that I can indeed access the server via cell data using 
>> NSURLSessionDataTask & friends. So yes, it appears that trying to go through 
>> IPV6-only networks using IPV4 APIs doesn’t work very well…
> 
> Okay, I’ve been looking around for a temporary stop-gap measure for the time 
> of being, and I think getaddrinfo() may work.
> 
> The problem I’m having is getting getaddrinfo() to accept a hostname with a 
> port number specification:
> 
>         struct addrinfo hints, *res, *res0;
>         int error;
>         int s;
>         const char *cause = NULL;
>         
>         memset(&hints, 0, sizeof(hints));
>         hints.ai_family = PF_UNSPEC;
>         hints.ai_socktype = SOCK_STREAM;
>         error = getaddrinfo(“www.myserver.com:12345 
> <http://www.myserver.com:12345/>", "http", &hints, &res0);
> 
> The above call to getaddrinfo() returns "nodename nor servname provided, or 
> not known”. It works (and I can connect) if I don’t specify the port number 
> (but it connects to the wrong server, of course).
> 
> Is there a way to use getaddrinfo() with a port number?
> 
> -Carl
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/macnetworkprog/james.cutler%40consultant.com
> 
> This email sent to james.cut...@consultant.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to