Home › Forums › Support › Await Option › Reply To: Await Option
May 22, 2015 at 00:47 #3860
Hello, for using NetworkComms.SendReceive in async/await aware code you are encouraged to do the following:
string result = await Task.Run(() => NetworkComms.SendReceive(...));
This will give you “offloading” mainly for the UI by moving the blocking call into a separate task, however you still won’t benefit from “scalability” since NetworkComms was internally designed for .NET 2.0 as explained.
For other constructions have in mind that NetworkComms uses the EAP (Event-based Asynchronous Pattern). You can refer to the MSDN for how to wrap this pattern into the TAP (Task-based Asynchronous Pattern).