mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
added getSocket proc (#11233)
This commit is contained in:
committed by
Andreas Rumpf
parent
7fb256bded
commit
de6b2e88d2
@@ -640,6 +640,21 @@ proc close*(client: HttpClient | AsyncHttpClient) =
|
||||
client.socket.close()
|
||||
client.connected = false
|
||||
|
||||
proc getSocket*(client: HttpClient): Socket =
|
||||
## Get network socket, useful if you want to find out more details about the connection
|
||||
##
|
||||
## this example shows info about local and remote endpoints
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## if client.connected:
|
||||
## echo client.getSocket.getLocalAddr
|
||||
## echo client.getSocket.getPeerAddr
|
||||
##
|
||||
return client.socket
|
||||
|
||||
proc getSocket*(client: AsyncHttpClient): AsyncSocket =
|
||||
return client.socket
|
||||
|
||||
proc reportProgress(client: HttpClient | AsyncHttpClient,
|
||||
progress: BiggestInt) {.multisync.} =
|
||||
client.contentProgress += progress
|
||||
|
||||
Reference in New Issue
Block a user