REQUST[multiple SSH sessions]
nixfreak opened this issue · comments
Hello
The library is awesome , I'm trying to figure out how to connect to multiple SSH sessions. Everytime I try it only connects once.
Would be great if you could share a sample or example how to do this.
Thank you for your interesting, can you post you code here?
`import asyncdispatch, ssh2, sysinfo
proc main() {.async.} =
var client = newSSHClient()
defer: client.disconnect()
await client.connect("127.0.0.1", "user", password="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
#echo await client.execCommand("uname -a")
echo "Machine Name: ", getMachineName()
#asyncCheck main()
waitFor main()
#asyncCheck main()
proc main1() {.async.} =
var client = newSSHClient()
defer: client.disconnect()
await client.connect("10.1.10.15", "user", password="xxxxx")
echo "Host Name: ", getHostName()
#echo await client.execCommand("ip addr show enp0s3|grep -i inet")
#echo("")
#echo await client.execCommand("whoami")
#echo await client.execCommand("date")
#echo await client.execCommand("id")
#asyncCheck main1()
waitFor main1()
#runForever() `
Actually got it working now, sorry about that