-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor_client.py
More file actions
41 lines (25 loc) · 949 Bytes
/
Copy pathmonitor_client.py
File metadata and controls
41 lines (25 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#coding: utf-8
import zmq
# set of tests
tests = []
#tests: list_topic
usage = " Запросить список подкатегорий: <show_children id = \"id категории\"/>\n\
Запросить список документов относящихся к категории: <show_docs id =\"id категории\"/>"
def client_start():
context = zmq.Context()
print "usage\n", usage
print ">>> Connectiong to monitor server..."
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:5554")
for req in tests:
print ">>> Sending request:\n ", req, "\n..."
socket.send(req)
reply = socket.recv()
print ">>> Recived reply: \n", reply
while (True):
req = raw_input("<<< Your request: ");
socket.send(req)
reply = socket.recv()
print ">>> Recived reply: \n", reply
if (__name__ == "__main__"):
client_start()