常用方法
常用方法
常用方法
常用方法
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); })); }