Added more SSL documentation to net module. (#15206)
* Added more SSL documentation to `net` module. * Changed two of the net.nim doc refs to links. * Update lib/pure/net.nim doc wording. Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> * Update lib/pure/net.nim - added space to doc URI Co-authored-by: alaviss <leorize+oss@disroot.org> * Fixed another doc URI in net module. * For net module doc added warning to connect procedure. * Update net.nim Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> Co-authored-by: alaviss <leorize+oss@disroot.org>
This commit is contained in:
parent
8a004e2fc0
commit
66eba3388a
1 changed files with 17 additions and 3 deletions
|
|
@ -20,7 +20,9 @@
|
||||||
## ====
|
## ====
|
||||||
##
|
##
|
||||||
## In order to use the SSL procedures defined in this module, you will need to
|
## In order to use the SSL procedures defined in this module, you will need to
|
||||||
## compile your application with the ``-d:ssl`` flag.
|
## compile your application with the ``-d:ssl`` flag. See the
|
||||||
|
## `newContext<net.html#newContext%2Cstring%2Cstring%2Cstring%2Cstring%2Cstring>`_
|
||||||
|
## procedure for additional details.
|
||||||
##
|
##
|
||||||
## Examples
|
## Examples
|
||||||
## ========
|
## ========
|
||||||
|
|
@ -36,9 +38,17 @@
|
||||||
## var socket = newSocket()
|
## var socket = newSocket()
|
||||||
## socket.connect("google.com", Port(80))
|
## socket.connect("google.com", Port(80))
|
||||||
##
|
##
|
||||||
|
## For SSL, use the following example (and make sure to compile with ``-d:ssl``):
|
||||||
|
##
|
||||||
|
## .. code-block:: Nim
|
||||||
|
## var socket = newSocket()
|
||||||
|
## var ctx = newContext()
|
||||||
|
## wrapSocket(ctx, socket)
|
||||||
|
## socket.connect("google.com", Port(443))
|
||||||
|
##
|
||||||
## UDP is a connectionless protocol, so UDP sockets don't have to explicitly
|
## UDP is a connectionless protocol, so UDP sockets don't have to explicitly
|
||||||
## call the ``connect`` procedure. They can simply start sending data
|
## call the `connect <net.html#connect%2CSocket%2Cstring>`_ procedure. They can
|
||||||
## immediately.
|
## simply start sending data immediately.
|
||||||
##
|
##
|
||||||
## .. code-block:: Nim
|
## .. code-block:: Nim
|
||||||
## var socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
|
## var socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
|
||||||
|
|
@ -1942,6 +1952,10 @@ proc connect*(socket: Socket, address: string, port = Port(0),
|
||||||
##
|
##
|
||||||
## The ``timeout`` parameter specifies the time in milliseconds to allow for
|
## The ``timeout`` parameter specifies the time in milliseconds to allow for
|
||||||
## the connection to the server to be made.
|
## the connection to the server to be made.
|
||||||
|
##
|
||||||
|
## **Warning:** This procedure appears to be broken for SSL connections as of
|
||||||
|
## Nim v1.0.2. Consider using the other `connect` procedure. See
|
||||||
|
## https://github.com/nim-lang/Nim/issues/15215 for more info.
|
||||||
socket.fd.setBlocking(false)
|
socket.fd.setBlocking(false)
|
||||||
|
|
||||||
socket.connectAsync(address, port, socket.domain)
|
socket.connectAsync(address, port, socket.domain)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue