[fix] AloneTcpClient

This commit is contained in:
Lkeme 2021-08-07 15:47:03 +08:00
parent b078d45700
commit 641ae05f33

View File

@ -79,7 +79,7 @@ class AloneTcpClient
*/ */
private static function unPackMsg($value, string $fmt = "N") private static function unPackMsg($value, string $fmt = "N")
{ {
return unpack($fmt, $value); return unpack($fmt, $value)[1];
} }
/** /**
@ -126,12 +126,6 @@ class AloneTcpClient
throw new Exception("Connection failure"); throw new Exception("Connection failure");
} }
if ($length == 4) $data = self::unPackMsg($data); if ($length == 4) $data = self::unPackMsg($data);
// 防止解包异常
if (!$data) {
throw new Exception("Connection failure");
} else {
$data = $data[1];
}
break; break;
} }
} catch (Exception $exception) { } catch (Exception $exception) {