4 ## Copyright (c) 2010-2017 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
22 def __init__(self, ip):
26 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
28 sock.connect((self._ip, 8474))
30 raise Exception("Failed to connect to prox on " + self._ip)
34 self._sock.sendall(msg + "\n");
41 if (len(self._dat) == 0):
42 self._dat = self._sock.recv(256);
46 while(len(self._dat)):
47 if (self._dat[0] == '\n'):
49 self._dat = self._dat[1:]
52 ret_str += self._dat[0];
53 self._dat = self._dat[1:]