Home > Net > SuperSocket use FixedHeaderReceiveFilter agreement
SuperSocket use FixedHeaderReceiveFilter agreement
Time:09-15
In supersocket custom protocol, if you meet some wrong data, or meaningless data, then to FixedHeaderReceiveFilter agreement, right behind the format of the data also can not accept, as if to send error data of the client being blocked, don't get any of the client's data, can restart the server to just go, what to do can after receive wrong data can also receive the correct data again?
class MyReceiveFilter: FixedHeaderReceiveFilter { Public MyReceiveFilter () : base (6) {
}
Protected override int GetBodyLengthFromHeader (byte [] the header, int offset, int length) { Return (int) header [offset + 4] * 256 + (int) header [offset + 5]; }
Protected override BinaryRequestInfo ResolveRequestInfo (ArraySegment The header, byte [] bodyBuffer, int offset, int length) { Return new BinaryRequestInfo (Encoding UTF8. Get string (header) Array, the header. The Offset, 4), bodyBuffer. CloneRange (Offset, length)); } }
CodePudding user response:
Have used SuperSocket framework,
CodePudding user response:
Under the interpretation of used SuperSocket framework
CodePudding user response:
The custom protocol? What are you going to do with glue bag broken bag? How to deal with bolt connection? Why not use ready-made communication protocol?