本文整理汇总了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();
}