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?

CodePudding user response:

reference ziqi0716 reply: 3/f
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?
with supersocket framework because of the company, there are several kinds of protocols can be used, website tutorial is not comprehensive, what's more, I answer to the question of the socket handle stick package also is not very understanding, at least according to the definition of the agreement, after receiving the data processing in baotou package tail, handle the stick pack don't know what to write

CodePudding user response:

reference 4 floor yesterday have response:
Quote: refer to the third floor ziqi0716 response:
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?
with supersocket framework because of the company, there are several kinds of protocols can be used, website tutorial is not comprehensive, what's more, I answer to the question of the socket handle stick package also is not very understanding, at least according to the definition of the agreement, after receiving the data treatment in baotou tail, the stick pack don't know what to write

Encapsulated communication protocol itself usually has to deal with broken packages, sticky packets, data validation, baotou package problems such as the end, we use only need some data for processing. Although I haven't seen the supersocket framework specific content, but good agreement will put these non-business related problems dealing with good, of course, the framework itself may put the encapsulated exposed a socket object, but you'd better not use directly, otherwise the frame then it has no meaning.

CodePudding user response:

reference 5 floor ziqi0716 reply:
Quote: refer to 4th floor yesterday have response:
Quote: reference ziqi0716 reply: 3/f
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?
with supersocket framework because of the company, there are several kinds of protocols can be used, website tutorial is not comprehensive, what's more, I answer to the question of the socket handle stick package also is not very understanding, at least according to the definition of the agreement, after receiving the data treatment in baotou tail, the stick pack don't know what to write

Encapsulated communication protocol itself usually has to deal with broken packages, sticky packets, data validation, baotou package problems such as the end, we use only need some data for processing. Although I haven't seen the supersocket framework specific content, but good agreement will put these non-business related problems dealing with good, of course, the framework itself may put the encapsulated exposed a socket object, but you'd better not use directly, otherwise the implications of the framework are less.
do you have a socket handle stick package method, I have a look

CodePudding user response:

Find the same problem, as long as accept data format is not in conformity with the agreement, this session even if you take the hair behind the right package also resolution not to come out,

CodePudding user response:

refer to the moon on the 7th floor gobi response:
find the same problem, as long as you accept the data format is not in conformity with the agreement, this session even if you take the hair behind the right package also resolution not to come out,
have a solution

CodePudding user response:

If is to control the model, using the end, that would be no errors accumulation, if transfer files, data, and these, should use binary form, oneself in the callback function
  •  Tags:  
  • C#
  • Related