Browse Source

增加获取数据超时

master
胡超1 2 years ago
parent
commit
d506080937
  1. 6
      CPF_Cef/Common/TcpClients.cs

6
CPF_Cef/Common/TcpClients.cs

@ -116,6 +116,7 @@ namespace AksWebBrowser.Common
{
try
{
int timeout = 0;
byte[] messageBytes = Encoding.UTF8.GetBytes(message);
byte[] header = BitConverter.GetBytes(messageBytes.Length);
byte[] data = new byte[header.Length + messageBytes.Length];
@ -126,6 +127,11 @@ namespace AksWebBrowser.Common
while (string.IsNullOrEmpty(jsonstr) && Parame.tcpClient != null)
{
Task.Delay(10).Wait();
timeout = timeout + 10;
if (timeout > 5000)
{
jsonstr = MainModel.str2Base64("{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "获取数据超时!" + "\"}");
}
}
if (string.IsNullOrEmpty(jsonstr))
{

Loading…
Cancel
Save