Restore `recvInto` for backwards compatibility
This commit is contained in:
parent
436a5a01ab
commit
862d6ad234
2 changed files with 24 additions and 0 deletions
|
|
@ -816,6 +816,18 @@ when defined(windows) or defined(nimdoc):
|
||||||
retFuture.complete(bytesReceived)
|
retFuture.complete(bytesReceived)
|
||||||
return retFuture
|
return retFuture
|
||||||
|
|
||||||
|
proc recvInto*(socket: AsyncFD, buf: cstring, size: int,
|
||||||
|
flags = {SocketFlag.SafeDisconn}): Future[int] =
|
||||||
|
## Reads **up to** ``size`` bytes from ``socket`` into ``buf``, which must
|
||||||
|
## at least be of that size. Returned future will complete once all the
|
||||||
|
## data requested is read, a part of the data has been read, or the socket
|
||||||
|
## has disconnected in which case the future will complete with a value of
|
||||||
|
## ``0``.
|
||||||
|
##
|
||||||
|
## **Warning**: The ``Peek`` socket flag is not supported on Windows.
|
||||||
|
|
||||||
|
socket.recvBuffer(buf, size, flags)
|
||||||
|
|
||||||
proc sendBuffer*(socket: AsyncFD, buf: pointer, size: int,
|
proc sendBuffer*(socket: AsyncFD, buf: pointer, size: int,
|
||||||
flags = {SocketFlag.SafeDisconn}): Future[void] =
|
flags = {SocketFlag.SafeDisconn}): Future[void] =
|
||||||
## Sends ``size`` bytes from ``buf`` to ``socket``. The returned future will complete once all
|
## Sends ``size`` bytes from ``buf`` to ``socket``. The returned future will complete once all
|
||||||
|
|
|
||||||
|
|
@ -785,6 +785,18 @@ when defined(windows) or defined(nimdoc):
|
||||||
retFuture.complete(bytesReceived)
|
retFuture.complete(bytesReceived)
|
||||||
return retFuture
|
return retFuture
|
||||||
|
|
||||||
|
proc recvInto*(socket: AsyncFD, buf: cstring, size: int,
|
||||||
|
flags = {SocketFlag.SafeDisconn}): Future[int] =
|
||||||
|
## Reads **up to** ``size`` bytes from ``socket`` into ``buf``, which must
|
||||||
|
## at least be of that size. Returned future will complete once all the
|
||||||
|
## data requested is read, a part of the data has been read, or the socket
|
||||||
|
## has disconnected in which case the future will complete with a value of
|
||||||
|
## ``0``.
|
||||||
|
##
|
||||||
|
## **Warning**: The ``Peek`` socket flag is not supported on Windows.
|
||||||
|
|
||||||
|
socket.recvBuffer(buf, size, flags)
|
||||||
|
|
||||||
proc sendBuffer*(socket: AsyncFD, buf: pointer, size: int,
|
proc sendBuffer*(socket: AsyncFD, buf: pointer, size: int,
|
||||||
flags = {SocketFlag.SafeDisconn}): Future[void] =
|
flags = {SocketFlag.SafeDisconn}): Future[void] =
|
||||||
## Sends ``size`` bytes from ``buf`` to ``socket``. The returned future will complete once all
|
## Sends ``size`` bytes from ``buf`` to ``socket``. The returned future will complete once all
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue