TangoClient.py 1016 Bytes
Newer Older
1
2
3
4
#!/usr/bin/env python
import socket
import sys

Manuela Kuhn's avatar
Manuela Kuhn committed
5
port = 51000
6
7

msgs = [
Manuela Kuhn's avatar
Manuela Kuhn committed
8
9
10
11
12
13
14
15
    'set localTarget /root/zeromq-data-transfer/data/target',
#    'set localTarget /space/projects/zeromq-data-transfer/data/target',
    'get localTarget',
    'set detectorDevice haspp06:10000/p06/eigerdectris/exp.01',
    'set filewriterDevice haspp06:10000/p06/eigerfilewriter/exp.01',
    'set historySize 0',
    'set storeData True',
    'set removeData True',
16
    'set whitelist ["localhost","zitpcx19282"]',
Manuela Kuhn's avatar
Manuela Kuhn committed
17
18
19
20
21
    'do start',
    'do status',
    'do stop',
#    'exit'
    'bye'
22
23
]

Manuela Kuhn's avatar
Manuela Kuhn committed
24
25
26
#host = socket.gethostname()
host = "asap3-bl-prx07"

27
sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Manuela Kuhn's avatar
Manuela Kuhn committed
28

29
30
31
32
33
34
35
try:
    sckt.connect((host, port))
except Exception, e:
    print "connect() failed", e
    sckt.close()
    sys.exit()

36
37
38
39
40
41
42
43
try:
    for msg in msgs:
        sckt.send(msg)
        print "sent (len %2d): %s" % (len(msg), msg)
        reply = sckt.recv(1024)
        print "recv (len %2d): %s " % (len( reply), reply)
finally:
    sckt.close()
44