artdaq_mfextensions  v1_03_03a
udp_send_mfmsg.py
1 #!/usr/bin/env python
2  # This file (udp_send_artdaq.py) was created by Ron Rechenmacher <ron@fnal.gov> on
3  # Jan 15, 2015. "TERMS AND CONDITIONS" governing this file are in the README
4  # or COPYING file. If you do not have such a file, one can be obtained by
5  # contacting Ron or Fermi Lab in Batavia IL, 60510, phone: 630-840-3000.
6  # $RCSfile: .emacs.gnu,v $
7  # rev="$Revision: 1.23 $$Date: 2012/01/23 15:32:40 $";
8 
9 import sys
10 import socket
11 USAGE='send host:port'
12 
13 # first byte is cmd
14 # 2nd byte is seqnum (yes, just 8 bits)
15 # rest is data (up to 1498)
16 
17 buf=''
18 
19 def main(argv):
20  print('len(argv)=%d'%(len(argv),))
21  if len(argv) != 2: print(USAGE); sys.exit()
22  node,port = argv[1].split(':')
23  buf='MF: 01-Jan-1970 01:01:01'
24  buf+="|0"
25  buf+="|" + node
26  buf+="|" + node
27  buf+="|WARNING"
28  buf+="|Test Message"
29  buf+="|UDP Send MFMSG"
30  buf+="|udp_send_mfmsg.py"
31  buf+="|1"
32  buf+="|Run 0, Subrun 0, Event 0"
33  buf+="|UDP Test program"
34  buf+="|This is the ARTDAQ UDP test string.\n\t It contains exactly 111 characters, making for a total size of 113 bytes."
35  s = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
36  s.sendto( buf, (node,int(port)) )
37  pass
38 
39 
40 if __name__ == "__main__": main(sys.argv)