def OnReceiveEcho(self): print print "Echo received" return True def OnReceiveFind(self, ds): for ii in range(1000): ds.PatientsName = 'titi' + str(ii) print "sending fake response: patient name: %s" % ds.PatientsName yield ds, 0xFF00 # responding to find request # create application entity MyAE = AE('localhost', 9999, [], [PatientRootFindSOPClass, VerificationSOPClass]) MyAE.OnAssociateRequest = OnAssociateRequest MyAE.OnReceiveEcho = OnReceiveEcho MyAE.OnReceiveFind = OnReceiveFind dcmtkscu.run_in_term( 'findscu -v -P -aec AE1 -k 0010,0010="*" -k 0008,0052="PATIENT"' ' localhost 9999') # start application entity MyAE.start() MyAE.QuitOnKeyboardInterrupt()