summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJoseph Henry <[email protected]>2021-05-25 15:24:28 -0700
committerJoseph Henry <[email protected]>2021-05-25 15:24:28 -0700
commitede730de1c7cac586ed957460af5d5700305c245 (patch)
tree13c6aa086f6d375bef4056e32e62695260fa1662 /examples
parent30d2e5f12993eef9e2164e0c4f1afa7da3ff401f (diff)
Update documentation
Diffstat (limited to 'examples')
-rw-r--r--examples/c/README.md7
-rw-r--r--examples/csharp/README.md61
-rw-r--r--examples/java/README.md14
-rw-r--r--examples/python/README.md16
4 files changed, 27 insertions, 71 deletions
diff --git a/examples/c/README.md b/examples/c/README.md
new file mode 100644
index 0000000..5e84b10
--- /dev/null
+++ b/examples/c/README.md
@@ -0,0 +1,7 @@
+# libzt C API usage examples
+
+## Links
+
+ - Getting Started: [docs.zerotier.com/sockets](https://docs.zerotier.com/sockets/tutorial.html)
+ - C API [Reference docs](https://docs.zerotier.com/autogen/libzt/files/_zero_tier_sockets_8h)
+ - C API [Header](../../include/ZeroTierSockets.h) \ No newline at end of file
diff --git a/examples/csharp/README.md b/examples/csharp/README.md
index 710cf5d..aa0888d 100644
--- a/examples/csharp/README.md
+++ b/examples/csharp/README.md
@@ -1,64 +1,11 @@
-ZeroTier Sockets for C# .NET
-=====
-
-A replacement for the [System.Net.Sockets.Socket](https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket) class built atop ZeroTier's SDK using P/INVOKE. It is designed to be a direct drop-in replacement. The library consists of three main objects: `ZeroTier.Node`, `ZeroTier.Event`, and `ZeroTier.Socket`. No code change is required in your application beyond a small snippet of startup code, renaming `Socket` to `ZeroTier.Socket` (where applicable) and handling a smattering of events.
-
-# Overview
+# ZeroTier Sockets for C# .NET
Add `ZeroTier.Sockets` to your project:
```powershell
Install-Package ZeroTier.Sockets
```
-See [example.cs](./example.cs) for complete client/server app implementation.
-
-```csharp
-using System.Net.Sockets;
-using ZeroTier;
-
-void OnZeroTierEvent(ZeroTier.Event e)
-{
- Console.WriteLine("{0} ({1})", e.EventCode, e.EventName);
-}
-...
-
-ZeroTier.Node node = new ZeroTier.Node("path", OnZeroTierEvent, 9991);
-
-node.Start();
-node.Join(0xc287ac0b42a6fb4c);
-
-...
-
-ZeroTier.Socket sock = new ZeroTier.Socket(ipAddr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
-
-sock.Connect(remoteEndPoint);
-
-...
-
-node.Stop();
-```
-
-# Building example without NuGet package (Advanced)
-
-From top-level repo directory, build `libzt.dll/so/dylib`:
-
-```bash
-make host_pinvoke_release
-```
-
-Copy `libzt.dll/so/dylib` into this project directory:
+## Links
-```
-cp ../../lib/release/${YOUR_HOST_TUPLE}-pinvoke/libzt.* .
-```
-Where `${YOUR_HOST_TUPLE}` is something like: `linux-x86_64`, `macOS-x86_64`, etc.
-
-Build language binding layer, `ZeroTier.Sockets.dll`:
-
-```bash
-cd examples/csharp
-${CSHARP_COMPILER} -target:library -out:ZeroTier.Sockets.dll ../../src/bindings/csharp/*.cs
-${CSHARP_COMPILER} -reference:ZeroTier.Sockets.dll example.cs
-./example.exe
-```
-Where `${CSHARP_COMPILER}` may be `csc` or `mono-csc` depending on your platform.
+ - Getting Started: [docs.zerotier.com/sockets](https://docs.zerotier.com/sockets/tutorial.html)
+ - Source [src/bindings/csharp](../../src/bindings/csharp)
diff --git a/examples/java/README.md b/examples/java/README.md
index deee95e..870f020 100644
--- a/examples/java/README.md
+++ b/examples/java/README.md
@@ -1,9 +1,15 @@
# Java example
-1). Build or download the `libzt-1.3.3.jar`, copy it to this directory
+Build or download the `libzt-${VERSION}.jar`, and copy it to this directory.
-2). Run `make`
+```
+make
+java -cp ".:libzt-${VERSION}.jar" Example server id_path 0123456789abcdef 9997
+java -cp ".:libzt-${VERSION}.jar" Example client id_path 0123456789abcdef ip.ip.ip.ip 9997
+```
-3). `java -cp ".:libzt-1.3.3.jar" Example id_path 0123456789abcdef 9997`
+## Links
-See [src/bindings/java](../../src/bindings/java) for wrapper implementation code.
+ - Getting Started: [docs.zerotier.com/sockets](https://docs.zerotier.com/sockets/tutorial.html)
+ - Java API: [docs.zerotier.com/sockets-java](https://docs.zerotier.com/sockets-java/)
+ - Source [src/bindings/java](../../src/bindings/java)
diff --git a/examples/python/README.md b/examples/python/README.md
index 640d97b..dd30bee 100644
--- a/examples/python/README.md
+++ b/examples/python/README.md
@@ -1,9 +1,5 @@
# Python example
-This example demonstrates how to use the ZeroTier socket interface provided by libzt in a Python application. The API is designed to be a drop-in replacement for the Python [Low-level networking interface](https://docs.python.org/3/library/socket.html).
-
-Note: Only `AF_INET` and `AF_INET6` address families are supported.
-
### Install
```
@@ -12,12 +8,12 @@ pip install libzt
### Run
```
-python3 example.py server id-path/bob 0123456789abcdef 9997 8080
-python3 example.py client id-path/alice 0123456789abcdef 9996 11.22.33.44 8080
+python3 example.py server id-path/bob 0123456789abcdef 8080
+python3 example.py client id-path/alice 0123456789abcdef ip.ip.ip.ip 8080
```
-*Where `9996` and `9997` are arbitrary ports that you allow ZeroTier to use for encrypted UDP traffic, port `8080` is an arbitrary port used by the client/server socket code, and `11.22.33.44` should be whatever IP address the network assigns your node.*
-
-### Implementation Details
+## Links
-- See [src/bindings/python](../../src/bindings/python)
+ - Getting Started: [docs.zerotier.com/sockets](https://docs.zerotier.com/sockets/tutorial.html)
+ - Source [src/bindings/python](../../src/bindings/python)
+ - Design inspired by: [Python Low-level networking interface](https://docs.python.org/3/library/socket.html)