let initiator send ping
This commit is contained in:
parent
af9dedf75a
commit
255366c337
|
@ -227,9 +227,9 @@ proc runApp(serverHostname: string, serverPort: Port, peerId: string,
|
||||||
if not hasSock:
|
if not hasSock:
|
||||||
break
|
break
|
||||||
echo "accepted!"
|
echo "accepted!"
|
||||||
await sock.send("ping")
|
|
||||||
let msg = await sock.recv(4)
|
let msg = await sock.recv(4)
|
||||||
echo "received message: ", msg
|
echo "received message: ", msg
|
||||||
|
await sock.send("pong")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# initiate a new connection
|
# initiate a new connection
|
||||||
|
@ -238,9 +238,9 @@ proc runApp(serverHostname: string, serverPort: Port, peerId: string,
|
||||||
asyncCheck handleServerMessages(serverConn)
|
asyncCheck handleServerMessages(serverConn)
|
||||||
let sock = await punchHole(punchdConn, serverConn, peerId, otherPeerId)
|
let sock = await punchHole(punchdConn, serverConn, peerId, otherPeerId)
|
||||||
echo "connected!"
|
echo "connected!"
|
||||||
|
await sock.send("ping")
|
||||||
let msg = await sock.recv(4)
|
let msg = await sock.recv(4)
|
||||||
echo "received message: ", msg
|
echo "received message: ", msg
|
||||||
await sock.send("pong")
|
|
||||||
|
|
||||||
proc main() =
|
proc main() =
|
||||||
if paramCount() < 3 or paramCount() > 4:
|
if paramCount() < 3 or paramCount() > 4:
|
||||||
|
|
Loading…
Reference in New Issue