RefactoringRope/JsonClient.py

branch
server_client_variant
changeset 168
53d76b4fc1ac
parent 166
6fc202183b3b
child 169
fb8a4182f12e
equal deleted inserted replaced
167:3c8e875d0326 168:53d76b4fc1ac
57 def __receiveJson(self): 57 def __receiveJson(self):
58 """ 58 """
59 Private method to receive a JSON encode command and data from the 59 Private method to receive a JSON encode command and data from the
60 server. 60 server.
61 """ 61 """
62 line = self.__connection.recv(1024 * 1024, socket.MSG_PEEK) # 1M buffer 62 line = self.__connection.recv(1024 * 1024, socket.MSG_PEEK)
63 # 1MB buffer
63 64
64 eol = line.find(b'\n') 65 eol = line.find(b'\n')
65 66
66 if eol >= 0: 67 if eol >= 0:
67 size = eol + 1 68 size = eol + 1
137 self.__connection.shutdown(socket.SHUT_RDWR) 138 self.__connection.shutdown(socket.SHUT_RDWR)
138 self.__connection.close() 139 self.__connection.close()
139 140
140 def poll(self): 141 def poll(self):
141 """ 142 """
142 Public method to check and receive one message (if available) 143 Public method to check and receive one message (if available).
143 """ 144 """
144 try: 145 try:
145 rrdy, wrdy, xrdy = select.select([self.__connection], [], [], 0) 146 rrdy, wrdy, xrdy = select.select([self.__connection], [], [], 0)
146 if self.__connection in rrdy: 147 if self.__connection in rrdy:
147 self.__receiveJson() 148 self.__receiveJson()

eric ide

mercurial