Example #1
0
        public virtual void Dispose()
        {
#if Matrix_Diagnostics
            Monitor.Info("Socket communicator diposed.");
#endif
            System.Net.Sockets.Socket socket = _socket;
            _socket = null;
            if (socket != null)
            {
                socket.Close();
            }

            SendAsyncCompleteEvent = null;
            MessageReceivedEvent   = null;

            ConnectedEvent    = null;
            DisconnectedEvent = null;

            ReleaseAsyncReceiveArgs();

#if Matrix_Diagnostics
            _monitor.Dispose();
#endif
            _serializer = null;
        }