public Task Start()
        {
            logger.Debug("TcpReceiver::Start()");

            if (state != ReceiverState.Initialized)
            {
                throw new InvalidOperationException("Invalid state " + state);
            }

            return(Task.Run(() =>
            {
                state = ReceiverState.Running;

                try
                {
                    logger.Debug("TcpReceiver thread started...");

                    byte[] buf = new byte[16256];

                    var tcpHanlder = new TcpHandler();

                    while (state == ReceiverState.Running)
                    {
                        int bytesReceived = socket.Receive(buf, SocketFlags.None);

                        if (bytesReceived > 0)
                        {
                            var frames = tcpHanlder.ProcessData(buf, bytesReceived, session);

                            if (frames != null && frames.Count > 0)
                            {
                                foreach (var frame in frames)
                                {
                                    var rtpData = frame.Data;
                                    RtpPacket rtpPacket = RtpPacket.Create(rtpData, rtpData.Length, session);
                                    if (rtpPacket != null)
                                    {
                                        OnRtpPacketReceived(rtpPacket);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (ObjectDisposedException)
                {
                    logger.Warn("RtpTcpReceiver::ObjectDisposedException");
                }
                catch (Exception ex)
                {
                    bool socketAborted = false;
                    var socketException = ex as SocketException;
                    if (socketException != null)
                    {
                        var code = socketException.SocketErrorCode;
                        if (code == SocketError.ConnectionAborted ||
                            code == SocketError.ConnectionReset ||
                            code == SocketError.Interrupted)
                        {
                            logger.Warn("Socket closed: " + code);
                            socketAborted = true;
                        }
                    }

                    if (!socketAborted)
                    {
                        logger.Error(ex);
                    }
                }
                finally
                {
                    Close();
                    logger.Debug("TcpReceiver thread stopped...");
                }
            }));
        }