关于C/S,在C#中使用TCP流发送数据到服务器端,为什么速度非常慢,有什么好的方法吗?
关于C/S,在C#中使用TCP流发送数据到服务器端,为什么速度非常慢,有什么好的方法吗?
比如:
tcpc=new TcpClient(HostIP,HostPort);
nts=tcpc.GetStream();
if(nts.CanWrite)
{
TcpSendData="您好!!!"
Encoding encode = Encoding.GetEncoding("gb2312");
byte[] toData=encode.GetBytes(TcpSendData.ToString());
nts.Write(toData,0,toData.Length);
nts.Flush();
}
将数据发送到服务器就有N的慢啊