The docs on Socket.BeginSend are pretty clear: "When your application calls BeginSend, the system will use a separate thread to execute the specified callback method, and will block on EndSend until the Socket sends the number of bytes requested or throws an exception."
In general, no async pattern makes sense if the combination of EndXxx(BeginXxx) doesn't have the same side effects (at least to you as a library user) as calling the synchronous Xxx method. Cheers, Stoyan On 5/11/07, Tony Hal <[EMAIL PROTECTED]> wrote:
.NET doc is not clear about this. The NetworkStream.EndWrite returns void which seems to indicate that when this call completes, all the requested bytes will have been written to the other end. Further investigation gave me this data: - NetworkStream.BeginWrite simply calls Socket.BeginSend. - Socket.BeginSend calls WSASocket with async mode. It looks to me then that it's possible that NetworkStream Begin/End Write returns less than requested in that case I'll have to code it such that the rest of the bytes will be sent. Note: NetworkStream.Write (the sync version) does send the whole things before returning. Internally it calls 'send' with blocking mode. The issue here is the async version. Could someone tell me the actual behavior of this call ? Currently I call NetworkStream.BeginWrite only once and assume the entire bytes will be sent. I need to know if I need to loop it or not. Thx. =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
=================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com