Added a close function to the ssl module.
This commit is contained in:
parent
0879f0b0a7
commit
8733886e53
3 changed files with 13 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue