diff --git a/README.md b/README.md index da67e90..c915f20 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ ZTS_EVENT_NETWORK_DOWN # Connecting and communicating with peers -Creating a standard socket connection generally works the same as it would using an ordinary socket interface, however with ZeroTier there is a subtle difference in how connections are established which may cause confusion. Since ZeroTier employs transport-triggered link provisioning a direct connection between peers will not exist until contact has been attempted by at least one peer. During this time before a direct link is available traffic will be handled via our free relay service. The provisioning of this direct link usually only takes a couple of seconds but it is important to understand that if you attempt something like s `zts_connect(...)` call during this time it may fail due to packet loss. Therefore it is advised to repeatedly call `zts_connect(...)` until it succeeds and to wait to send additional traffic until `ZTS_EVENT_PEER_P2P` has been received for the peer you are attempting to communicate with. All of the above is optional, but it will improve your experience. +Creating a standard socket connection generally works the same as it would using an ordinary socket interface, however with ZeroTier there is a subtle difference in how connections are established which may cause confusion. Since ZeroTier employs transport-triggered link provisioning a direct connection between peers will not exist until contact has been attempted by at least one peer. During this time before a direct link is available traffic will be handled via our free relay service. The provisioning of this direct link usually only takes a couple of seconds but it is important to understand that if you attempt something like s `zts_connect(...)` call during this time it may fail due to packet loss. Therefore it is advised to repeatedly call `zts_connect(...)` until it succeeds and to wait to send additional traffic until `ZTS_EVENT_PEER_DIRECT` has been received for the peer you are attempting to communicate with. All of the above is optional, but it will improve your experience. `tl;dr: Try a few times and wait a few seconds` diff --git a/examples/cpp/adhoc.cpp b/examples/cpp/adhoc.cpp index 3650dfd..ec6ee0e 100644 --- a/examples/cpp/adhoc.cpp +++ b/examples/cpp/adhoc.cpp @@ -35,10 +35,10 @@ * root server has passed contact information to both peers that a direct connection will be * established. Therefore, it is required that multiple connection attempts be undertaken * when initially communicating with a peer. After a transport-triggered link is - * established libzt will inform you via ZTS_EVENT_PEER_P2P for a specific peer ID. No + * established libzt will inform you via ZTS_EVENT_PEER_DIRECT for a specific peer ID. No * action is required on your part for this callback event. * - * Note: In these initial moments before ZTS_EVENT_PEER_P2P has been received for a + * Note: In these initial moments before ZTS_EVENT_PEER_DIRECT has been received for a * specific peer, traffic may be slow, jittery and there may be high packet loss. * This will subside within a couple of seconds. * diff --git a/examples/cpp/client.cpp b/examples/cpp/client.cpp index 405d539..75b35d3 100644 --- a/examples/cpp/client.cpp +++ b/examples/cpp/client.cpp @@ -127,10 +127,10 @@ void myZeroTierEventCallback(void *msgPtr) * root server has passed contact information to both peers that a direct connection will be * established. Therefore, it is required that multiple connection attempts be undertaken * when initially communicating with a peer. After a transport-triggered link is - * established libzt will inform you via ZTS_EVENT_PEER_P2P for a specific peer ID. No + * established libzt will inform you via ZTS_EVENT_PEER_DIRECT for a specific peer ID. No * action is required on your part for this callback event. * - * Note: In these initial moments before ZTS_EVENT_PEER_P2P has been received for a + * Note: In these initial moments before ZTS_EVENT_PEER_DIRECT has been received for a * specific peer, traffic may be slow, jittery and there may be high packet loss. * This will subside within a couple of seconds. * diff --git a/examples/cpp/comprehensive.cpp b/examples/cpp/comprehensive.cpp index 2f1f57a..eeaf08a 100644 --- a/examples/cpp/comprehensive.cpp +++ b/examples/cpp/comprehensive.cpp @@ -35,10 +35,10 @@ * root server has passed contact information to both peers that a direct connection will be * established. Therefore, it is required that multiple connection attempts be undertaken * when initially communicating with a peer. After a transport-triggered link is - * established libzt will inform you via ZTS_EVENT_PEER_P2P for a specific peer ID. No + * established libzt will inform you via ZTS_EVENT_PEER_DIRECT for a specific peer ID. No * action is required on your part for this callback event. * - * Note: In these initial moments before ZTS_EVENT_PEER_P2P has been received for a + * Note: In these initial moments before ZTS_EVENT_PEER_DIRECT has been received for a * specific peer, traffic may be slow, jittery and there may be high packet loss. * This will subside within a couple of seconds. * diff --git a/examples/cpp/earthtest.cpp b/examples/cpp/earthtest.cpp index 0e29549..a6dff6a 100644 --- a/examples/cpp/earthtest.cpp +++ b/examples/cpp/earthtest.cpp @@ -35,10 +35,10 @@ * root server has passed contact information to both peers that a direct connection will be * established. Therefore, it is required that multiple connection attempts be undertaken * when initially communicating with a peer. After a transport-triggered link is - * established libzt will inform you via ZTS_EVENT_PEER_P2P for a specific peer ID. No + * established libzt will inform you via ZTS_EVENT_PEER_DIRECT for a specific peer ID. No * action is required on your part for this callback event. * - * Note: In these initial moments before ZTS_EVENT_PEER_P2P has been received for a + * Note: In these initial moments before ZTS_EVENT_PEER_DIRECT has been received for a * specific peer, traffic may be slow, jittery and there may be high packet loss. * This will subside within a couple of seconds. * diff --git a/examples/cpp/server.cpp b/examples/cpp/server.cpp index ff7c5a7..51e61bb 100644 --- a/examples/cpp/server.cpp +++ b/examples/cpp/server.cpp @@ -127,10 +127,10 @@ void myZeroTierEventCallback(void *msgPtr) * root server has passed contact information to both peers that a direct connection will be * established. Therefore, it is required that multiple connection attempts be undertaken * when initially communicating with a peer. After a transport-triggered link is - * established libzt will inform you via ZTS_EVENT_PEER_P2P for a specific peer ID. No + * established libzt will inform you via ZTS_EVENT_PEER_DIRECT for a specific peer ID. No * action is required on your part for this callback event. * - * Note: In these initial moments before ZTS_EVENT_PEER_P2P has been received for a + * Note: In these initial moments before ZTS_EVENT_PEER_DIRECT has been received for a * specific peer, traffic may be slow, jittery and there may be high packet loss. * This will subside within a couple of seconds. * diff --git a/examples/objective-c/adhoc.m b/examples/objective-c/adhoc.m index 0b0a194..46b2c67 100644 --- a/examples/objective-c/adhoc.m +++ b/examples/objective-c/adhoc.m @@ -44,10 +44,10 @@ * root server has passed contact information to both peers that a direct connection will be * established. Therefore, it is required that multiple connection attempts be undertaken * when initially communicating with a peer. After a transport-triggered link is - * established libzt will inform you via ZTS_EVENT_PEER_P2P for a specific peer ID. No + * established libzt will inform you via ZTS_EVENT_PEER_DIRECT for a specific peer ID. No * action is required on your part for this callback event. * - * Note: In these initial moments before ZTS_EVENT_PEER_P2P has been received for a + * Note: In these initial moments before ZTS_EVENT_PEER_DIRECT has been received for a * specific peer, traffic may be slow, jittery and there may be high packet loss. * This will subside within a couple of seconds. * diff --git a/examples/swift/main.swift b/examples/swift/main.swift index 85c010c..bb82621 100644 --- a/examples/swift/main.swift +++ b/examples/swift/main.swift @@ -40,10 +40,10 @@ import Foundation * root server has passed contact information to both peers that a direct connection will be * established. Therefore, it is required that multiple connection attempts be undertaken * when initially communicating with a peer. After a transport-triggered link is - * established libzt will inform you via ZTS_EVENT_PEER_P2P for a specific peer ID. No + * established libzt will inform you via ZTS_EVENT_PEER_DIRECT for a specific peer ID. No * action is required on your part for this callback event. * - * Note: In these initial moments before ZTS_EVENT_PEER_P2P has been received for a + * Note: In these initial moments before ZTS_EVENT_PEER_DIRECT has been received for a * specific peer, traffic may be slow, jittery and there may be high packet loss. * This will subside within a couple of seconds. * @@ -200,8 +200,8 @@ let myZeroTierEventCallback : @convention(c) (UnsafeMutableRawPointer?) -> Void ipstr, msg.addr->nwid) */ // Peer events - case ZTS_EVENT_PEER_P2P: - print("ZTS_EVENT_PEER_P2P --- node=%llx\n", msg.peer->address) + case ZTS_EVENT_PEER_DIRECT: + print("ZTS_EVENT_PEER_DIRECT --- node=%llx\n", msg.peer->address) case ZTS_EVENT_PEER_RELAY: print("ZTS_EVENT_PEER_RELAY --- node=%llx\n", msg.peer->address)