The following example program creates a client that connects to a server. The client is built with an asynchronous socket, so execution of the client application is not suspended while the server returns a response. The application sends a string to the server and then displays the string returned by the server on the console.
This source is based on the Microsoft site example. Microsoft example is written based on the old IAsyncResult pattern. But this source is rewritten according to the Task-based Asynchronous Pattern. (TAP)
I use two template source for rewrite old pattern to Task-based Asynchronous Pattern.
Template1: use Begin* and End* methods to change Pattern.
Template2: use base socket methods to change Pattern. (like Send, Receive, and so on)