GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
run_command.py
Go to the documentation of this file.
1#!/usr/bin/env python2
2
3import ctypes
4
5import ROOT
6ROOT.PyConfig.IgnoreCommandLineOptions = True
7
8
9def run_command(command, host, port):
10 sock = ROOT.TSocket(host,port)
11 sock.Send(command)
12 message = ROOT.TMessage()
13 bytes_received = sock.Recv(message)
14 if bytes_received <= 0:
15 return None
16
17 if message.What()==ROOT.kMESS_STRING:
18 arr = ctypes.create_string_buffer(256)
19 message.ReadString(arr,256)
20 return arr.value
21 elif message.What()==ROOT.kMESS_OBJECT:
22 obj = message.ReadObject(message.GetClass())
23 return obj
24 else:
25 return None