RatioMaster_source.RM.AcceptTcpConnection C# (CSharp) Method

AcceptTcpConnection() private method

private AcceptTcpConnection ( ) : void
return void
        private void AcceptTcpConnection()
        {
            Socket socket1 = null;
            try
            {
                Encoding encoding1 = Encoding.GetEncoding(0x6faf);
                string text1;
                while (true)
                {
                    socket1 = localListen.AcceptSocket();
                    byte[] buffer1 = new byte[0x43];
                    if ((socket1 != null) && socket1.Connected)
                    {
                        NetworkStream stream1 = new NetworkStream(socket1);
                        stream1.ReadTimeout = 0x3e8;
                        try
                        {
                            stream1.Read(buffer1, 0, buffer1.Length);
                        }
                        catch (Exception)
                        {
                        }

                        text1 = encoding1.GetString(buffer1, 0, buffer1.Length);
                        if ((text1.IndexOf("BitTorrent protocol") >= 0) && (text1.IndexOf(encoding1.GetString(this.currentTorrentFile.InfoHash)) >= 0))
                        {
                            byte[] buffer2 = createHandshakeResponse();
                            stream1.Write(buffer2, 0, buffer2.Length);
                        }

                        socket1.Close();
                        stream1.Close();
                        stream1.Dispose();
                    }
                }
            }
            catch (Exception exception1)
            {
                AddLogLine("Error in AcceptTcpConnection(): " + exception1.Message);
                return;
            }
            finally
            {
                if (socket1 != null)
                {
                    socket1.Close();
                    AddLogLine("Closed socket");
                }

                CloseTcpListener();
            }
        }