Exemple #1
0
        public void Close_internal(out int error)
        {
            error = 0;

            if (jServerSocket != null)
            {
                try
                {
                    jServerSocket.close();
                }
                catch (Exception e)
                {
                    error = 10022;                     //WSAEINVAL (Invalid argument)
#if DEBUG
                    Console.WriteLine("Caught exception during Close_internal jServerSocket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
#endif
                }
                try
                {
                    jServerSocketChannel.close();
                }
                catch (Exception e)
                {
                    error = 10022;                     //WSAEINVAL (Invalid argument)
#if DEBUG
                    Console.WriteLine("Caught exception during Close_internal jServerSocketChannel - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
#endif
                }
                jServerSocket        = null;
                jServerSocketChannel = null;
            }
            else if (jSocket != null)
            {
                try
                {
                    jSocket.close();
                }
                catch (Exception e)
                {
                    error = 10022;                     //WSAEINVAL (Invalid argument)
#if DEBUG
                    Console.WriteLine("Caught exception during Close_internal jSocket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
#endif
                }
                try
                {
                    jSocketChannel.close();
                }
                catch (Exception e)
                {
                    error = 10022;                     //WSAEINVAL (Invalid argument)
#if DEBUG
                    Console.WriteLine("Caught exception during Close_internal jSocketChannel - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
#endif
                }
                jSocket        = null;
                jSocketChannel = null;
            }
        }