这是一个客户端的socket通信,服务器端以写好。想解决这个问题:
1、客户端发送一条数据后,信息超过3秒没有返回则被认为是超时!
2、超时后不断开与服务器的连接,能够继续接收数据。
3、用tcpClient2.ReceiveTimeout = 3000; 这个属性怎么控制一次,以后就控制不住了!
private void sendrfiddata()
{
string receiveData = "";
string carband = textBox2.Text; tcpClient2.ReceiveTimeout = 3000; senddata.WriteLine("entrybalance," + carband);
senddata.Flush(); try
{
byte[] Data = new Byte[400];
Int32 bytes = ns.Read(Data, 0, Data.Length);
receiveData = Encoding.Default.GetString(Data, 0, bytes);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
} }
1、客户端发送一条数据后,信息超过3秒没有返回则被认为是超时!
2、超时后不断开与服务器的连接,能够继续接收数据。
3、用tcpClient2.ReceiveTimeout = 3000; 这个属性怎么控制一次,以后就控制不住了!
private void sendrfiddata()
{
string receiveData = "";
string carband = textBox2.Text; tcpClient2.ReceiveTimeout = 3000; senddata.WriteLine("entrybalance," + carband);
senddata.Flush(); try
{
byte[] Data = new Byte[400];
Int32 bytes = ns.Read(Data, 0, Data.Length);
receiveData = Encoding.Default.GetString(Data, 0, bytes);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
} }
你重新断开数据库在连接试下 其他的是否能正常运行 如果能就是数据库死锁了