old_flsystem/PCRobot/MyReceiveFilter.cs

29 lines
823 B
C#
Raw Permalink Normal View History

2022-09-20 03:10:29 +00:00
using SuperSocket.ProtoBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PCRobot
{
class MyReceiveFilter : TerminatorReceiveFilter<StringPackageInfo>
{
public MyReceiveFilter()
: base(Encoding.ASCII.GetBytes("\r\n"))
{
}
public override StringPackageInfo ResolvePackage(IBufferStream bufferStream)
{
var msg = bufferStream.ReadString((int)bufferStream.Length, Encoding.UTF8);
var arr = msg.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
StringPackageInfo spi = new StringPackageInfo(arr[0], arr[1], null);
return spi;
}
// other code you need implement according yoru protocol details
}
}