Re: Can NetworkStream.Write() block?



Hello GAZ,

myNetworkStream.Write(byte[], int offset, int size);

From the MSDN documentation:
"
Remarks:
The Write method starts at the specified offset and sends size bytes
from the contents of buffer to the network. The Write method blocks
until the requested number of bytes is sent or a SocketException is
thrown. If you receive a SocketException, use the
SocketException.ErrorCode property to obtain the specific error code,
and refer to the Windows Sockets version 2 API error code
documentation
in MSDN for a detailed description of the error.
"
It says the call blocks until the bytes are sent but aren't the bytes
just queued to the write buffer until the OS feels like sending them
over the wire? Therefore doesn't the call always return pretty much
immediately anyway?

My guess is that it'll block if the buffer is full.

--
Jesse Houwing
jesse.houwing at sogeti.nl


.



Relevant Pages

  • Can NetworkStream.Write() block?
    ... myNetworkStream.Write(byte, int offset, int size); ... From the MSDN documentation: ... If you receive a SocketException, use the SocketException.ErrorCode property to obtain the specific error code, and refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error. ... It says the call blocks until the bytes are sent but aren't the bytes just queued to the write buffer until the OS feels like sending them over the wire? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Error log design...
    ... > It seems the first problem is in the specs. ... > log buffer. ... And the error code would tell you how much data follows. ... > b) Output the limited buffer when button is pressed ...
    (comp.lang.c)
  • Re: Error log design...
    ... > It seems the first problem is in the specs. ... > log buffer. ... And the error code would tell you how much data follows. ... > b) Output the limited buffer when button is pressed ...
    (comp.arch.embedded)
  • Re: _bstr_t or CComBSTR
    ... CComBSTR ... returns an error code. ... It then carries this buffer around ... reason entirely - to relinquish control of the underlying BSTR pointer, ...
    (microsoft.public.vc.language)
  • Re: DeviceIoControl (USB)
    ... > VB because it's not always known what other DLL calls are executed ... The MSDN documentation for DeviceIOControlstates: ... it also sets the error code which you may ... driver development, not for discussion of driver access. ...
    (microsoft.public.vb.winapi)

Loading