本文整理匯總了C#中System.IO.BufferedStream.StreamReadLine方法的典型用法代碼示例。如果您正苦於以下問題:C# BufferedStream.StreamReadLine方法的具體用法?C# BufferedStream.StreamReadLine怎麽用?C# BufferedStream.StreamReadLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.BufferedStream
的用法示例。
在下文中一共展示了BufferedStream.StreamReadLine方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ProcessResult
private async void ProcessResult(TcpClient socket)
{
var input = new BufferedStream(socket.GetStream());
var command = input.StreamReadLine();
if (command.StartsWith("START"))
{
var targetIp = command.Split(' ')[1];
if (!Outputs.ContainsKey(targetIp))
{
var tcpClient = new TcpClient();
await tcpClient.ConnectAsync(targetIp.Split(':')[0], int.Parse(targetIp.Split(':')[1]));
if (tcpClient.Connected)
{
Console.WriteLine("Recording started: {0}", targetIp);
this.Outputs.Add(targetIp, new BufferedStream(tcpClient.GetStream()));
}
}
}
else if (command.StartsWith("STOP"))
{
var targetIp = command.Split(' ')[1];
Console.WriteLine("Recording stopped: {0}", targetIp);
if (Outputs.ContainsKey(targetIp))
{
var stream = Outputs[targetIp];
Outputs.Remove(targetIp);
stream.Close();
}
}
socket.Close();
}