Partial Send in Socket.BeginSend( List<ArraySegment> )?

221 Views Asked by At

I have a question regarding the System.Net.Socket.BeginSend method.

public IAsyncResult BeginSend(
    IList<ArraySegment<byte>> buffers,
    SocketFlags socketFlags,
    AsyncCallback callback,
    object state
)

If SocketFlags.None is indicated in socketFlags parameter, will all buffers be sent before callback is fired?

  • If the answer to the above question is NO: The EndSend method only returns the bytes of sent buffer. How to know which ArraySegments are sent? I need stupidly loop down the buffers to find the sent ones? And will it possible that half ArraySegment is sent?

  • If the answer to the above question is YES: Does it have any limit on the size for the buffers? What if I send 10MB buffers at once?

Generally I don't understand how the.NET processes the ArraySegment internally. Will the ArraySegment buffers merged into a big buffer before sending?

0

There are 0 best solutions below