RatioMaster_source.RM.OpenTcpListener C# (CSharp) Method

OpenTcpListener() private method

private OpenTcpListener ( ) : void
return void
        private void OpenTcpListener()
        {
            try
            {
                if (checkTCPListen.Checked && localListen == null && currentProxy.ProxyType == ProxyType.None)
                {
                    localListen = new TcpListener(IPAddress.Any, int.Parse(currentTorrent.port));
                    try
                    {
                        localListen.Start();
                        AddLogLine("Started TCP listener on port " + currentTorrent.port);
                    }
                    catch
                    {
                        AddLogLine("TCP listener is alredy started from other torrent or from your torrent client");
                        return;
                    }

                    Thread myThread = new Thread(AcceptTcpConnection);
                    myThread.Name = "AcceptTcpConnection() Thread";
                    myThread.Start();
                }
            }
            catch (Exception e)
            {
                AddLogLine("Error in OpenTcpListener(): " + e.Message);
                if (localListen != null)
                {
                    localListen.Stop();
                    localListen = null;
                }

                return;
            }

            AddLogLine("OpenTcpListener() successfully finished!");
        }