src/eric7/EricNetwork/EricJsonClient.py

branch
eric7
changeset 10522
c04e878aa308
parent 10439
21c28b0f9e41
child 10524
ed4fd87c4d4c
equal deleted inserted replaced
10521:a51b382e47d7 10522:c04e878aa308
55 cmd = json.dumps(commandDict) + "\n" 55 cmd = json.dumps(commandDict) + "\n"
56 self.__connection.sendall(cmd.encode("utf8", "backslashreplace")) 56 self.__connection.sendall(cmd.encode("utf8", "backslashreplace"))
57 57
58 def __receiveJson(self): 58 def __receiveJson(self):
59 """ 59 """
60 Private method to receive a JSON encode command and data from the 60 Private method to receive a JSON encoded command and data from the
61 server. 61 server.
62 62
63 @return tuple containing the received command and a dictionary 63 @return tuple containing the received command and a dictionary
64 containing the associated data 64 containing the associated data
65 @rtype tuple of (str, dict) 65 @rtype tuple of (str, dict)
70 if len(length) < 9: 70 if len(length) < 9:
71 # invalid length string received 71 # invalid length string received
72 return None, None 72 return None, None
73 73
74 length = int(length) 74 length = int(length)
75 data = b"" 75 data = bytearray()
76 while len(data) < length: 76 while len(data) < length:
77 newData = self.__connection.recv(length - len(data)) 77 newData = self.__connection.recv(length - len(data))
78 if not newData: 78 if not newData:
79 return None, None 79 return None, None
80 80

eric ide

mercurial