Home > Net >  Open multiple asynchronous
Open multiple asynchronous

Time:10-10



Network flow moment please open multiple asynchronous writes, then the server will receive the order go bad?
If the asynchronous BeginWrite () for synchronous Write ()?

CodePudding user response:

Your server will not be in receiving the order together again?

CodePudding user response:

Words you didn't understand what is the use of the asynchronous and asynchronous, general asynchronous receive judgment was carried out on the network flow is based on the existing agreements, such as Modbus or custom variable length agreement, judge the entire frame (to check complete frame), after the callback function is invoked, received instruction Type identification, the Data to get the Data part, according to the Type and Data to complete the specified operation, this is clearly in the mess with you!

CodePudding user response:

If you are afraid of messing add serial number at the head of the total number of packages, data length and so on the head of the other bytes,

CodePudding user response:

An asynchronous write is no problem, the problem and the general is a buffer, you just went to there is a passage in the buffer to write

So you need to make sure that is actually write order, don't put a parcel parallel write, if you need to write logically bags in parallel by several times in this should be used to ensure the agreement

CodePudding user response:

For asynchronous thread, execution order can not be sure
  •  Tags:  
  • C#
  • Related