//需要发送的消息协议
WWW www_instance = new WWW(url, message);
//时间函数单位毫秒
Stopwatch sw = new Stopwatch();
sw.Start();
{
if (sw.ElapsedMilliseconds >= 1000)
{
if (www_instance.error != null)
{
Debug.Log("连接超时-----请稍后");
sw.Stop();
break;
}
else
{
if (sw.ElapsedMilliseconds >= 4500)
{
ty = www_instance.bytes;
if (ty.Length == 0)
{
Debug.Log("连接超时---- - 请稍后,没有返回数据");
sw.Stop();
break;
}
}
}
}
}
sw.Stop();
Debug.LogError(sw.ElapsedMilliseconds);
WWW www_instance = new WWW(url, message);
//时间函数单位毫秒
Stopwatch sw = new Stopwatch();
sw.Start();
byte[] ty = new byte[0];
//检测是否加载完成
while (!www_instance.isDone){
if (sw.ElapsedMilliseconds >= 1000)
{
if (www_instance.error != null)
{
Debug.Log("连接超时-----请稍后");
sw.Stop();
break;
}
else
{
if (sw.ElapsedMilliseconds >= 4500)
{
ty = www_instance.bytes;
if (ty.Length == 0)
{
Debug.Log("连接超时---- - 请稍后,没有返回数据");
sw.Stop();
break;
}
}
}
}
}
sw.Stop();
Debug.LogError(sw.ElapsedMilliseconds);
ty = www_instance.bytes;
//消息解析
HttpHand.message(ty);