SuperSocket icon indicating copy to clipboard operation
SuperSocket copied to clipboard

1.6.6.1 to 2.0.0-beta 17

Open romanhamidulin opened this issue 1 year ago • 4 comments

Please help how can i update to new verion. I have IRequestInfo

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SuperSocket.SocketBase.Protocol;

namespace Matrix.Cross.MatrixTeleofisUSPD
{
    /// <summary>
    /// пакет от матрикса
    /// </summary>
    public class TeleofisUSPDRequest : IRequestInfo
    {
        public string Key { get; private set; }

        public byte[] buffer { get; private set; }

        public TeleofisUSPDRequest(byte[] Buffer)
        {
            buffer = Buffer;
        }
    }
}

IReceiveFilter

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NLog;
using SuperSocket.SocketBase.Protocol;

namespace Matrix.Cross.MatrixTeleofisUSPD
{
    public class TeleofisUSPDReceiveFilter : IReceiveFilter<TeleofisUSPDRequest>
    {
        private static readonly Logger logger = LogManager.GetCurrentClassLogger();

        public const int MAX_LENGTH = 1024 * 50;


        public TeleofisUSPDReceiveFilter()
        {

        }

        /// <summary>
        /// в этот буфер - конвеер пакетов
        /// </summary>
        private byte[] tail = null;

        public TeleofisUSPDRequest Filter(byte[] readBuffer, int offset, int length, bool toBeCopied, out int rest)
        {
            rest = 0;
            return new TeleofisUSPDRequest(readBuffer.Skip(offset).Take(length).ToArray());
        }

        public void Reset()
        {
            tail = null;
        }

        public IReceiveFilter<TeleofisUSPDRequest> NextReceiveFilter { get; private set; }
        public int LeftBufferSize
        {
            get; private set;
        }
        public FilterState State { get; private set; }
    }
}

AppSession

AppSession<TeleofisUSPDSession, TeleofisUSPDRequest>

server intialization

public override void Initialize(IAppServer<TeleofisUSPDSession, TeleofisUSPDRequest> appServer, ISocketSession socketSession)
        {
            try
            {
                
            }
            catch (Exception ex)
            {
                logger.Error(ex, "ошибка при приеме соединения");
            }
            finally
            {
                base.Initialize(appServer, socketSession);
            }

        }

romanhamidulin avatar Jul 18 '23 06:07 romanhamidulin

Actually your receive filter base on SuperSocket 1.6 was implemented incorrectly.

kerryjiang avatar Jul 29 '23 18:07 kerryjiang

Do you have any specification for your protocol or package format?

kerryjiang avatar Jul 29 '23 18:07 kerryjiang

Actually your receive filter base on SuperSocket 1.6 was implemented incorrectly.

Вut it works fine and I wouldn't be thinking about upgrading if it wasn't for the switch to linux and net

Do you have any specification for your protocol or package format? No

romanhamidulin avatar Jul 31 '23 02:07 romanhamidulin

That's strange. The communication mode in your system is working in a special way, so how you implement the protocol doesn't matter.

kerryjiang avatar Aug 06 '23 19:08 kerryjiang