Пример #1
0
        protected virtual void Dispose(bool disposing)
        {
            // If you need thread safety, use a lock around these
            // operations, as well as in your methods that use the resource.
            if (!_disposed)
            {
                if (disposing)
                {
                    if (client != null)
                    {
                        client.CloseConnection(client.GetSystemAddressFromIndex(0), true, 0);
                        client.Dispose();
                    }
                    if (socketDescriptor != null)
                    {
                        socketDescriptor.Dispose();
                    }
                    if (receiveBitStream != null)
                    {
                        receiveBitStream.Dispose();
                    }
                    if (sentBitStream != null)
                    {
                        sentBitStream.Dispose();
                    }
                }

                client           = null;
                socketDescriptor = null;
                receiveBitStream = null;
                sentBitStream    = null;


                _disposed = true;
            }
        }