at System.Array.Clear(System.Array, Int32, Int32)
at System.Collections.Generic.List`1[[System.Byte, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Clear()
at Kael.SocketIOCP.Share.Share.BufferManager.Init()
at Kael.SocketIOCP.Server.SocketServerSuper.BeginReceive(System.Net.Sockets.SocketAsyncEventArgs)
at Kael.SocketIOCP.Server.SocketServerSuper.Asyn_Completed(System.Object, System.Net.Sockets.SocketAsyncEventArgs)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(System.Net.Sockets.SocketAsyncEventArgs)
at System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(System.Net.Sockets.SocketError, Int32, System.Net.Sockets.SocketFlags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
求解决方法
看样子是多线程操作List的问题。List<string>不是一个线程安全的类。可以考虑使用.net4.0提供的线程安全集合。或者自行为你的List什么add,delete之前加一个锁.
FCL的线程安全集合参考:http://msdn.microsoft.com/zh-cn/library/dd460718.aspx
加锁可以参考:http://www.cnblogs.com/heyuquan/archive/2013/01/10/2854311.html
net4.0提供的线程安全集合有哪些
@拖鞋王子:FCL的线程安全集合参考:http://msdn.microsoft.com/zh-cn/library/dd460718.aspx
额,那么有缘,上午我发个问题,过了一会你的问题出现在我的问题上方,下午又来了,我来捧个场