Added a close function to the ssl module.

This commit is contained in:
dom96 2010-10-27 19:06:25 +01:00
commit 8733886e53
3 changed files with 13 additions and 0 deletions

View file

@ -74,6 +74,12 @@ proc send*(sock: TSecureSocket, data: string) =
if BIO_write(sock.bio, data, data.len()) <= 0:
OSError()
proc close*(sock: TSecureSocket) =
## Closes the socket
if BIO_free(sock.bio) <= 0:
ERR_print_errors_fp(stderr)
OSError()
when isMainModule:
var s: TSecureSocket
echo connect(s, "smtp.gmail.com", 465)