nim-webrtc/examples/sctp_ping.nim

14 lines
369 B
Nim
Raw Normal View History

2022-11-25 16:22:51 +00:00
import chronos, stew/byteutils
import ../webrtc/sctp
proc main() {.async.} =
let sctp = Sctp.new(port = 4244)
let conn = await sctp.connect(initTAddress("127.0.0.1:4242"), sctpPort = 13)
while true:
await conn.write("ping".toBytes)
let msg = await conn.read()
echo "Received: ", string.fromBytes(msg)
await sleepAsync(1.seconds)
waitFor(main())