chore: remove outdated examples
This commit is contained in:
parent
97cd366402
commit
dd624fd8a2
|
@ -1,25 +0,0 @@
|
||||||
import chronos, stew/byteutils
|
|
||||||
import ../webrtc/sctp as sc
|
|
||||||
|
|
||||||
let sctp = Sctp.new(port = 4242)
|
|
||||||
proc serv(fut: Future[void]) {.async.} =
|
|
||||||
sctp.startServer(13)
|
|
||||||
fut.complete()
|
|
||||||
let conn = await sctp.listen()
|
|
||||||
echo "await read()"
|
|
||||||
let msg = await conn.read()
|
|
||||||
echo "read() finished"
|
|
||||||
echo "Receive: ", string.fromBytes(msg)
|
|
||||||
await conn.close()
|
|
||||||
sctp.stopServer()
|
|
||||||
|
|
||||||
proc main() {.async.} =
|
|
||||||
let fut = Future[void]()
|
|
||||||
asyncSpawn serv(fut)
|
|
||||||
await fut
|
|
||||||
let address = TransportAddress(initTAddress("127.0.0.1:4242"))
|
|
||||||
let conn = await sctp.connect(address, sctpPort = 13)
|
|
||||||
await conn.write("test".toBytes)
|
|
||||||
await conn.close()
|
|
||||||
|
|
||||||
waitFor(main())
|
|
|
@ -1,14 +0,0 @@
|
||||||
import chronos, stew/byteutils
|
|
||||||
import ../webrtc/sctp
|
|
||||||
|
|
||||||
proc main() {.async.} =
|
|
||||||
let
|
|
||||||
sctp = Sctp.new(port = 4244)
|
|
||||||
address = TransportAddress(initTAddress("127.0.0.1:4242"))
|
|
||||||
conn = await sctp.connect(address, sctpPort = 13)
|
|
||||||
await conn.write("test".toBytes)
|
|
||||||
let msg = await conn.read()
|
|
||||||
echo "Client read() finished ; receive: ", string.fromBytes(msg)
|
|
||||||
await conn.close()
|
|
||||||
|
|
||||||
waitFor(main())
|
|
|
@ -1,13 +0,0 @@
|
||||||
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())
|
|
|
@ -1,19 +0,0 @@
|
||||||
import chronos, stew/byteutils
|
|
||||||
import ../webrtc/sctp
|
|
||||||
|
|
||||||
proc sendPong(conn: SctpConnection) {.async.} =
|
|
||||||
var i = 0
|
|
||||||
while true:
|
|
||||||
let msg = await conn.read()
|
|
||||||
echo "Received: ", string.fromBytes(msg)
|
|
||||||
await conn.write(("pong " & $i).toBytes)
|
|
||||||
i.inc()
|
|
||||||
|
|
||||||
proc main() {.async.} =
|
|
||||||
let sctp = Sctp.new(port = 4242)
|
|
||||||
sctp.startServer(13)
|
|
||||||
while true:
|
|
||||||
let conn = await sctp.listen()
|
|
||||||
asyncSpawn conn.sendPong()
|
|
||||||
|
|
||||||
waitFor(main())
|
|
|
@ -1,13 +0,0 @@
|
||||||
import chronos, stew/byteutils
|
|
||||||
import ../webrtc/sctp
|
|
||||||
|
|
||||||
proc main() {.async.} =
|
|
||||||
let sctp = Sctp.new(port = 4242)
|
|
||||||
sctp.startServer(13)
|
|
||||||
let conn = await sctp.listen()
|
|
||||||
let msg = await conn.read()
|
|
||||||
echo "Receive: ", string.fromBytes(msg)
|
|
||||||
await conn.close()
|
|
||||||
sctp.stopServer()
|
|
||||||
|
|
||||||
waitFor(main())
|
|
Loading…
Reference in New Issue