examples: add classic network snake test example

Adding this example to test multiple concurrent socket connections.
This commit is contained in:
Scott Feldman
2024-01-22 13:29:42 -08:00
committed by deadprogram
parent e7931c6a22
commit aa7bd47c68
3 changed files with 184 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
//go:build ninafw || wioterminal
package main
import (
"log"
"time"
"tinygo.org/x/drivers/netlink"
"tinygo.org/x/drivers/netlink/probe"
)
var (
ssid string
pass string
)
func init() {
time.Sleep(2 * time.Second)
link, _ := probe.Probe()
err := link.NetConnect(&netlink.ConnectParams{
Ssid: ssid,
Passphrase: pass,
})
if err != nil {
log.Fatal(err)
}
}