Administrator
2023-07-10 a6151ec7339aebfd37647af5544e900dbe17a93c
server.py
@@ -106,7 +106,7 @@
                try:
                    # 如果带有头
                    if _str.startswith("##"):
                        print("接受到数据:",f"{_str[:20]}...{_str[-20:]}")
                        total_length = int(_str[2:10])
                        _str = _str[10:]
                        # 防止socket数据发生粘连
@@ -116,6 +116,7 @@
                                _str += d.decode(encoding='gbk')
                    type = data_process.parseType(_str)
                except Exception as e:
                    print("接受到的异常数据:", f"{_str[:10]}...{_str[-10:]}")
                    if str(e).find("Unterminated string starting") > -1:
                        _str = _str.replace("\n", "")
                        type = data_process.parseType(_str)