def main(): if not isHaggleRunning(): print "haggle is not running!" sys.exit(-1) print sys.argv[1], sys.argv[2],sys.argv[3] fileowner = sys.argv[1] interest = sys.argv[2] loopcounter = int(sys.argv[3]) hagglehandle_ptr = haggle.haggle_handle_t() retcode = haggle.haggle_handle_get("a17",byref(hagglehandle_ptr)) if retcode < 0: print "unable to get haggle handle retcode=",retcode sys.exit(-1) print on_dataobject_func registerEvents(hagglehandle_ptr) retcode = haggle.haggle_ipc_add_application_interest(hagglehandle_ptr, "FileOwner", interest); for i in range(loopcounter): print i content = "testmessage|"+fileowner+"||"+str(i)+"|" publishDataObjectFromString(hagglehandle_ptr,content,fileowner,i) while(True): time.sleep(5)
def main(): if not isHaggleRunning(): print "haggle is not running!" sys.exit(-1) print sys.argv[1] interest = sys.argv[1] hagglehandle_ptr = haggle.haggle_handle_t() retcode = haggle.haggle_handle_get("imagesubscribe1",byref(hagglehandle_ptr)) if retcode < 0: print "unable to get haggle handle retcode=",retcode sys.exit(-1) print on_dataobject_func registerEvents(hagglehandle_ptr) retcode = haggle.haggle_ipc_add_application_interest(hagglehandle_ptr, "FileOwner", interest); while(True): time.sleep(5)