c# socket receive send 传输中文怎样实现
string sendStr = "hello!This is a socket test";byte[] bs = Encoding.ASCII.GetBytes(sendStr);//把字符串编码为字节
Console.WriteLine("发送信息.....");
c.Send(bs, bs.Length, 0);//发送信息
那我用中文传输怎样实现
Socket c = s.Accept();
NetworkStream ns = new NetworkStream(c);
StreamReader sr = new StreamReader(ns);
Console.WriteLine(sr.ReadLine());
是这样吗???