Here is a client that can be used with the pyspMonitor to
measure the connection speed. It sends the
dictionary { 'command': 'noop'}
which does not
cause any action.
#!/usr/bin/env python import sys, time import zmq, socket, json import PySpectra.zmqIfc as zmqIfc def sendReceive( hsh): node = socket.gethostbyname( socket.getfqdn()) context = zmq.Context() sckt = context.socket(zmq.REQ) # # prevent context.term() from hanging, if the message # is not consumed by a receiver. # sckt.setsockopt(zmq.LINGER, 1) sckt.connect('tcp://%s:7779' % node) hshEnc = json.dumps( hsh) res = sckt.send( hshEnc) lst = zmq.select([sckt], [], [], 0.1) if sckt in lst[0]: hshEnc = sckt.recv() hsh = json.loads( hshEnc) if hsh[ 'result'] != 'done': print( "Unexpected restult %" % hsh[ 'result']) sckt.close() context.term() return def main(): startTime = time.time() for i in range( 1000): if (i % 100) == 0: print( "Count %d" % i) sendReceive( { 'command': [ 'noop %d' % i]}) print( "totalTime %g " % (time.time() - startTime)) if __name__ == "__main__": try: main() except Exception as e: print( "main: exception: %s" % repr(e))