29 lines
823 B
C#
29 lines
823 B
C#
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
|
|
}
|
|
}
|