BitServer.SMTPconnection.dataRec C# (CSharp) Method

dataRec() private method

private dataRec ( IAsyncResult ar ) : void
ar IAsyncResult
return void
        private void dataRec(IAsyncResult ar)
        {
            int i = 0;
            try
            {
                i = c.Client.EndReceive(ar);
            }
            catch
            {
                return;
            }
            if (i > 0)
            {
                for (int j = 0; j < i; j++)
                {
                    if (buffer[j] == 10)
                    {
                        if (SMTPcommand != null)
                        {
                            string line = Encoding.UTF8.GetString(lastLine, 0, linePos - 1);
                            linePos = 0;
                            if (line.Contains(" ") && !dataMode)
                            {
                                SMTPcommand(this,
                                    line.ToUpper().Substring(0, line.IndexOf(' ')),
                                    line.Substring(line.IndexOf(' ') + 1).Split(' '),
                                    line);
                            }
                            else
                            {
                                SMTPcommand(this, line.ToUpper(), new string[]{}, line);
                            }
                        }
                    }
                    else
                    {
                        lastLine[linePos++] = buffer[j];
                        if (linePos >= lastLine.Length)
                        {
                            msg(552,"Make Lines shorter you stupid!");
                            exit();
                            linePos = 0;
                            return;
                        }
                    }
                }
                if (IsConnected)
                {
                    c.Client.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(dataRec), null);
                }
            }
        }