0
 My applicatiion is crash twice and the stacktrace as below:

 Description: The process was terminated due to an unhandled exception.
 Exception Info: System.NullReferenceException
 Stack:
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

我的应用程序使用 Begin/End 异步 IO 模型,如下所示:

 HttpRequest.BeginGetRequestStream(callback,context);
 singal.wait(3000);
 .......
 context.dispose();//the context contain buffer to be read and buffer to be sent and the networkstream.

是不是线程启动时调用context.dispose方法去掉了重叠数据导致的问题?但是我必须设置一个时间等待,否则线程会被阻塞很长时间。

4

0 回答 0