Created
January 19, 2019 12:06
-
-
Save kobi2187/bfe1fa6a5dc131a17d4fe13123f92cd5 to your computer and use it in GitHub Desktop.
connects to an open port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# purpose: | |
# check that we're able to connect to site:port | |
import uri, net, system | |
proc check_site*(host: Uri, port: Port): bool {.raises: [OSError, | |
SslError].} = | |
var socket = newSocket() | |
try: | |
socket.connect(host.hostname, port) | |
return true | |
# except OSError: | |
except: | |
echo getCurrentExceptionMsg() | |
echo getCurrentException().getStackTrace | |
return false | |
finally: | |
socket.close |
index out of bounds: (i:-1) <= (n:-1)
main.nim(58) main
main.nim(56) main
ctrl.nim(55) start
manage_network.nim(9) check_site
net.nim(1582) connect
nativesockets.nim(266) getAddrInfo
oserr.nim(62) raiseOSError
system.nim(3831) []
system.nim(3016) sysFatal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
compile with -d:ssl