while (true)
{
TcpClient tc = listener.AcceptTcpClient();
NetworkStream ns = tc.GetStream();
byte[] buffer = new byte[1024];
int postion = 1;
string data = string.Empty;
while (postion > 0)
{
postion = ns.Read(buffer, 0, buffer.Length);
data = System.Text.Encoding.UTF8.GetString(buffer, 0, buffer.Length);
//System.Threading.Thread.Sleep(50);
Console.WriteLine(data);
}
tc.Close(); }
{
TcpClient tc = listener.AcceptTcpClient();
NetworkStream ns = tc.GetStream();
byte[] buffer = new byte[1024];
int postion = 1;
string data = string.Empty;
while (postion > 0)
{
postion = ns.Read(buffer, 0, buffer.Length);
data = System.Text.Encoding.UTF8.GetString(buffer, 0, buffer.Length);
//System.Threading.Thread.Sleep(50);
Console.WriteLine(data);
}
tc.Close(); }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货