send because of Task can not be more than one thread calls at the same time, so, I want to write a can be multithreaded call the method at the same time, to deal with concurrency, excuse me this how to deal with, change the concurrent to handle the tasks one by one?
the class one question{
Task to send;//the same time can only be called a
Public async void command to send command (string)
{
Mission sent=ClientWebSocket. SendAsync (new ArraySegment(Encoding UTF8. GetBytes (command), WebSocketMessageType. Text, true, the new CancellationToken ());
Await the task to send;
}
}
CodePudding user response:
Didn't understand what are you doingThe Parallel. Invoke (()=& gt; Task1 (), ()=& gt; Task2 (), ()=& gt; Task3 ());