本文整理汇总了C#中System.Net.Sockets.NetworkStream.Cut方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkStream.Cut方法的具体用法?C# NetworkStream.Cut怎么用?C# NetworkStream.Cut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Sockets.NetworkStream
的用法示例。
在下文中一共展示了NetworkStream.Cut方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
private Socket Connect()
{
while (true)
try
{
Socket _Socket = new TcpClient(host, port).Client;
string s = Res.get.Replace("_host_", host + ":" + port).Replace("_page_", page);
_Socket.Send(s);
_NetworkStream = new NetworkStream(_Socket);
_NetworkStream.ReadTimeout = 40000;
string s2 = _NetworkStream.Cut("\r\n\r\n").ToStr();
name = Regex.Match(s2, "icy-name:(.+)\r").Groups[1].Value;
blocksize = int.Parse(Regex.Match(s2, @"icy-metaint:(.+)\b").Groups[1].Value);
return _Socket;
}
catch { }
}
示例2: Send
public void Send(object o)
{
i++;
string s = (string)o;
try
{
Socket _Socket = new TcpClient("192.84.196.226", 8080).Client;
using (NetworkStream _NetworkStream = new NetworkStream(_Socket))
{
_NetworkStream.Write(string.Format(Res.proxy, s));
string s2 = _NetworkStream.Cut("\r\n").ToStr();
s.Trace(s2.Trim());
if (s2 == _ok)
{
if (!_ListA.Contains(s)) _ListA.Add(s);
_ListA.Flush();
"success".Trace();
}
_Socket.Close();
}
}
catch (IOException) { "err".Trace(); }
catch (SocketException) { "connerr".Trace(); }
i--;
}