> On Dec 8, 2014, at 2:10 PM, Jens Alfke <j...@mooseyard.com> wrote: > > >> On Dec 8, 2014, at 1:54 PM, Josh Graessley <jgraess...@apple.com >> <mailto:jgraess...@apple.com>> 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.
Using SCNetworkReachabilityCreateWithAddressPair() on a connected socket should give you an SCNetworkReachabilityRef that you can use to check for kSCNetworkReachabilityFlagsIsWWAN. If the bit is set, you're on cellular, so close the socket. Otherwise, proceed. Dieter > > 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 :( > > —Jens > _______________________________________________ > 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/dieter%40apple.com > > This email sent to die...@apple.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