Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.6.6.1 to 2.0.0-beta 17 #668

Open
romanhamidulin opened this issue Jul 18, 2023 · 4 comments
Open

1.6.6.1 to 2.0.0-beta 17 #668

romanhamidulin opened this issue Jul 18, 2023 · 4 comments

Comments

@romanhamidulin
Copy link

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);
            }

        }

@kerryjiang
Copy link
Owner

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

@kerryjiang
Copy link
Owner

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

@romanhamidulin
Copy link
Author

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

@kerryjiang
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants