Exemplo n.º 1
0
        public void Close()
        {
            lock (initializationLock)
            {
                try
                {
                    if (null != requestQueue)
                    {
                        requestQueue.Stop();
                    }

                    if (null != incomingStreamHandler)
                    {
                        incomingStreamHandler.Stop();
                        incomingStreamHandler = null;
                    }

                    if (null != outgoingStreamHandler)
                    {
                        outgoingStreamHandler.Stop();
                        outgoingStreamHandler = null;
                    }

                    if (null != socket)
                    {
                        socket.Close();
                        socket = null;
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Error closing socket: " + e.Message);
                }
            }
        }
Exemplo n.º 2
0
        public void Close()
        {
            try
            {
                if (null != incomingStreamHandler)
                {
                    incomingStreamHandler.Stop();
                }

                if (null != outgoingStreamHandler)
                {
                    outgoingStreamHandler.Stop();
                }

                if (null != socket)
                {
                    socket.Close();
                }

                if (null != requestQueue)
                {
                    requestQueue.Clear();
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("Error closing socket: " + e.Message);
            }
        }