defaultPath in NEProvider

defaultPath in NEProvider can be used for only connection created by createTCPConnectionToEndpoint/createUDPSessionToEndpoint ? Or for any TCP connection created by custom code.

Accepted Reply

NWPath has lots of internal state, not reflected in its

-description
result, that can cause two paths to not be equal.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

While it’s recommended, the NEProvider architecture does not require you to use the NWTCPConnection API. The docs for

createTCPConnection(to:enableTLS:tlsParameters:delegate:)
say:

This method provides a convenient way to create TCP connections from a Network Extension Provider. It is preferred over using the sockets API.

which indicates a preference, not a requirement.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your response eskimo.


Yes, It's working as mentioned. However, isEqualToPath provide by NWPath returns false eventhough the new and old paths are same.


NWPath - newpath -
    status = satisfied
    reasonCode = 0
    reason = Path is satisfied
    clientID = D34CF87E-343E-4AAE-8F66-6CE98E795AB2
    isExpensive = YES

NWPath - oldpath -
    status = satisfied
    reasonCode = 0
    reason = Path is satisfied
    clientID = D34CF87E-343E-4AAE-8F66-6CE98E795AB2
    isExpensive = YES

What platform, and what version of that platform, are you trying this on?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

iOS 10.0.1(14A403) on iPhone 6. Thanks again!

NWPath has lots of internal state, not reflected in its

-description
result, that can cause two paths to not be equal.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks!! Make sense.

faced with so complex situation, so how to estimate the new and old paths are same ( cannot use isEqualToPath ?) ?!?

I’m not sure I understand your question. The recommend is to call

-isEqualToPath:
; the confusing part is that
-description
doesn’t render all the properties of the path, and thus
-isEqualToPath:
can return false even though the descriptions are the same.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"