private void AcceptCallback(IAsyncResult asyncResult) { Socket socket = null; try { socket = Sock.EndAccept(asyncResult); } catch (ObjectDisposedException) { return; } catch (Exception ex) { EventProvider.ExecuteErrorHandler(ex, SocketErrorLocation.EndStart); return; } TcpReceiveSocket receiveSocket = new TcpReceiveSocket(socket, SocketSide.Client, EventProvider); if (receiveSocket.Start()) { TcpClientSockets.Add(receiveSocket); TcpClientSockets.TrimExcess(); } EventProvider.ExecuteHandshakeHandler(((IPEndPoint)socket.RemoteEndPoint).Address, receiveSocket); Sock.BeginAccept(AcceptCallback, null); }