Ejemplo n.º 1
0
 public static async Task <NetworkStream> Process(this Socket tcpClient, Func <byte[], int, byte[]> dataManager)
 {
     return(await tcpClient.CarefullyExecute(
                async (client) =>
     {
         if (tcpClient.Connected)
         {
             using (var nstream = new NetworkStream(tcpClient, false))
             {
                 await nstream.HandleRequests(dataManager);
                 //nstream.Close();
             }
         }
         return null;
     }
                , (error) =>
     {
         Console.WriteLine(error.StackTrace);
         Console.WriteLine(error.Message);
     }));
 }