GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
run_command.py
Go to the documentation of this file.
1 #!/usr/bin/env python2
2 
3 import ctypes
4 
5 import ROOT
6 ROOT.PyConfig.IgnoreCommandLineOptions = True
7 
8 
9 def 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
def run_command(command, host, port)
Definition: run_command.py:9