skip to Main Content

How, in Python 3, can I have a client open a socket to a server, send 1 line of JSON-encoded data, read 1 line JSON-encoded data back, and continue?

I have the following code for a server listening on a port: def handle_oracle_query(self, sock, address): sockIn = sock.makefile('rb') sockOut = sock.makefile('wb') line = sockIn.readline() submitted_data = json.loads(line) self.get_thread_specific_storage()['environmental_variables'] = submitted_data['environmental_variables'] self.get_thread_specific_storage()['cgi'] = submitted_data['cgi'] generate_output() print_output(sockOut) sock.close() sockIn.close() sockOut.close() self.remove_thread_specific_storage()…

VIEW QUESTION
Back To Top
Search