المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : NetworkStream.BeginWrite() blocks as called from thread



C# Programming
05-14-2010, 04:23 PM
I've got main application (which listens on some port and accepts connections) with a TcpClient variable in the fields which is used to get connected client.

I run some time consuming BackgroundWorker from that main application which performs some calculations and send data to that connected TcpClient with asynchronous BeginWrite().

DataWrite AsyncCallback is defined in the main application body.

Why BegineWrite() called from BackgroundWorker blocks until all data was sent and DataWrite AsyncCallback finished?

How to solve the problem to send thread results without DataWrite block?

????????