On Dec 8, 2014, at 1:54 PM, Josh Graessley <
email@hidden> wrote:
The socket option to set that restriction is not public.
Well, crap. I'm trying to do the right thing and stop using SCReachability to preflight connections (as discussed in an earlier thread here), but one of the things we use SCReachability for is to avoid trying to connect over cell networks when the client app doesn't want us to. Looks like we don't have a feasible workaround for that.
I'm thinking of giving up on removing the preflighting. It's a rather dangerous change that alters the internal logic a lot, and parts of it like this are proving difficult to rewrite.
If you are trying to avoid any cellular traffic, you would also need a way to avoid sending DNS over cellular. That functionality is also not public.
DNS traffic probably isn't big enough to worry about. We have this feature so apps can avoid syncing databases containing huge media attachments over cell networks.
If you can use a CFSocketStream to establish the connection, you could use kCFStreamPropertySocketNativeHandle to fetch the file descriptor out. POSIX/BSD socket APIs won’t trigger cellular to dial or VPNs to come up among other problems.
GCDAsyncSocket is a very large and complex class [that I didn't write] and I don't want to rewrite it :(