public void Close()

in src/main/csharp/Transport/Tcp/TcpTransport.cs [169:249]


        public void Close()
        {
            Thread theReadThread = null;

            if(closed.CompareAndSet(false, true))
            {
                lock(myLock)
                {
                    try
                    {
                        socket.Shutdown(SocketShutdown.Both);
                    }
                    catch
                    {
                    }

                    try
                    {
                        if(null != socketWriter)
                        {
                            socketWriter.Close();
                        }
                    }
                    catch
                    {
                    }
                    finally
                    {
                        socketWriter = null;
                    }

                    try
                    {
                        if(null != socketReader)
                        {
                            socketReader.Close();
                        }
                    }
                    catch
                    {
                    }
                    finally
                    {
                        socketReader = null;
                    }

                    try
                    {
                        socket.Close();
                    }
                    catch
                    {
                    }

                    theReadThread = this.readThread;
                    this.readThread = null;
                    started = false;
                }
            }

            if(null != theReadThread)
            {
                try
                {
                    if(Thread.CurrentThread != theReadThread
#if !NETCF
 && theReadThread.IsAlive
#endif
)
                    {
                        if(!theReadThread.Join((int) MAX_THREAD_WAIT.TotalMilliseconds))
                        {
                            theReadThread.Abort();
                        }
                    }
                }
                catch
                {
                }
            }
        }