SuperSocket
SuperSocket copied to clipboard
1.6.6.1 to 2.0.0-beta 17
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);
}
}
Actually your receive filter base on SuperSocket 1.6 was implemented incorrectly.
Do you have any specification for your protocol or package format?
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
That's strange. The communication mode in your system is working in a special way, so how you implement the protocol doesn't matter.