mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-11 02:13:42 +00:00
examples: add classic network snake test example
Adding this example to test multiple concurrent socket connections.
This commit is contained in:
committed by
deadprogram
parent
e7931c6a22
commit
aa7bd47c68
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user