Can NetworkStream.Write() block?
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?
Thanks.
.
Relevant Pages
- Re: Can NetworkStream.Write() block?
... From the MSDN documentation: ... from the contents of buffer to the network. ... until the requested number of bytes is sent or a SocketException is ... SocketException.ErrorCode property to obtain the specific error code, ... (microsoft.public.dotnet.languages.csharp) - Re: InputStream
... Especially if reading from a network connection or ... > The displayed message always says that the read amount is lower than the ... read(bytebuffer, int offset, int maxWanted) is for doing this. ... (comp.lang.java.programmer) - Re: Can NetworkStream.Write() block?
... myNetworkStream.BeginWrite(bytebuffer, int offset, int size) since all that does is create a backlog of BeginWrite threads all waiting to complete. ... In general, you can assume asynchronous calls are *more* efficient than their synchronous companions, since those *always* take up a thread (namely the thread waiting for completion) while the asynchronous ones generally only take up a thread when executing the completion callback. ... The overlapped requests are simply queued until there's an opportunity to process them. ... (microsoft.public.dotnet.languages.csharp) - Question about IntPtr
... I am having a problem while trying to use a buffer in a Function call. ... have ported the code from the MSDN documentation and it seems that the ... function expects a different type of input parameter than the one MSDN is ... ' I have to copy the values as my function returns an array of Doubles ... (microsoft.public.dotnet.languages.vb) - Re: Generics Questions
... What am I missing? ... public class SingleByteConverter: IByteConverter{ ... public int WriteToBuffer(float value, bytebuffer, int offset) { ... (microsoft.public.dotnet.languages.csharp) |
|