In Stefen Toub's code Awaiting Socket Operations : it doesn't mention about the usage of its async methods. I mean how the Server program will be calling the async methods using await? Ther isn't any main() also. Please elaborate over this. I tried creating a main() and calling the SocketExtensions.ReceiveAsync(sock,awaitable);
public static void Main(string[] str)
{
Console.WriteLine("\n\n<<<<<<<<<<< Server is starting... >>>>>>>>>>>>>>>>>");
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 10100);
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
var args = new SocketAsyncEventArgs();
args.SetBuffer(new byte[0x100000], 0, 0x100000);
var awaitable = new SocketAwaitable(args);
while(true)
SocketExtensions.ReceiveAsync(sock,awaitable);
}
But it didn't work for me.