import os import sys import time sys.path.append('../DDSP/') from DDSP import DDSP if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) time.sleep(3) ddsp.addContent(b'123456789012345678901234567890123456789012345678901234567890abcd') time.sleep(10) print ("Reached the end of Publisher.py") os._exit(1)
import os import sys import random import hashlib import _thread sys.path.append('../../DDSP/') from DDSP import DDSP sys.path.append('../') from DemoUtil import updateScreen from DemoUtil import query from DemoUtil import generateFile if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) stdscr = curses.initscr() _thread.start_new_thread(updateScreen, (stdscr, ddsp, False)) _thread.start_new_thread(query, (stdscr, ddsp, True)) while True: key = stdscr.getch() if key == ord('a'): fid = generateFile(sys.argv[2]) ddsp.addContent(fid) stdscr.addstr(3, 0, "Published a File: " + fid.decode('utf-8')) stdscr.refresh() stdscr.addstr(4, 0, " ") elif key == ord('r'): for record_dict in ddsp.getResourceTable(): if record_dict['ip_addr'] == '127.0.0.1':
import curses import time import os import sys import random import hashlib import _thread sys.path.append('../../DDSP/') from DDSP import DDSP sys.path.append('../') from DemoUtil import query if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) stdscr = curses.initscr() stdscr.addstr(0, 10, "A Subscripter Using the APIs of DDSP") stdscr.addstr(1, 0, "Press 'q' to quit.") stdscr.addstr(3, 0, " ") _thread.start_new_thread(query, (stdscr, ddsp, False)) while True: key = stdscr.getch() if key == ord('q'): stdscr.clear() curses.endwin() break os._exit(1)
import os import sys import time sys.path.append('../DDSP/') from DDSP import DDSP if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) time.sleep(3) ddsp.requestContent(b'123456789012345678901234567890123456789012345678901234567890abcd') for record_dict in ddsp.getResourceTable(): print (record_dict['fid'] + "\t" + record_dict['ip_addr'] + "\t" + record_dict['ttl'] + "\t" + record_dict['status']) time.sleep(10) print ("Reached the end of Subscriber.py") os._exit(1)
import os import sys import time sys.path.append('../DDSP/') from DDSP import DDSP if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) time.sleep(3) ddsp.addContent( b'123456789012345678901234567890123456789012345678901234567890abcd') time.sleep(10) print("Reached the end of Publisher.py") os._exit(1)
import curses import time import os import sys import random import hashlib import _thread sys.path.append('../../DDSP/') from DDSP import DDSP sys.path.append('../') from DemoUtil import updateScreen if __name__ == '__main__': ddsp = DDSP(sys.argv[1]) stdscr = curses.initscr() _thread.start_new_thread(updateScreen, (stdscr, ddsp, True)) while True: key = stdscr.getch() if key == ord('q'): stdscr.clear() curses.endwin() break os._exit(1)
import os import sys import time sys.path.append('../DDSP/') from DDSP import DDSP if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) time.sleep(3) ddsp.requestContent( b'123456789012345678901234567890123456789012345678901234567890abcd') for record_dict in ddsp.getResourceTable(): print(record_dict['fid'] + "\t" + record_dict['ip_addr'] + "\t" + record_dict['ttl'] + "\t" + record_dict['status']) time.sleep(10) print("Reached the end of Subscriber.py") os._exit(1)
import os import sys import time sys.path.append('../DDSP/') from DDSP import DDSP if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) while True: for record_dict in ddsp.getResourceTable(): if record_dict['ip_addr'] != '127.0.0.1': interested = True for duplicated in ddsp.getResourceTable(): if duplicated['fid'] == record_dict['fid'] and duplicated['ip_addr'] == '127.0.0.1': interested = False break if interested: ddsp.requestContent(record_dict['fid'].encode('utf-8')) print (record_dict['fid'] + "\t" + record_dict['ip_addr'] + "\t" + record_dict['ttl'] + "\t" + record_dict['status']) time.sleep(3) os._exit(1)
import time import os import sys import random import hashlib import _thread sys.path.append('../../DDSP/') from DDSP import DDSP sys.path.append('../') from DemoUtil import updateScreen from DemoUtil import query from DemoUtil import generateFile if __name__ == '__main__': ddsp = DDSP(sys.argv[1], sys.argv[2]) stdscr = curses.initscr() _thread.start_new_thread(updateScreen, (stdscr, ddsp, False)) _thread.start_new_thread(query, (stdscr, ddsp, True)) while True: key = stdscr.getch() if key == ord('a'): fid = generateFile(sys.argv[2]) ddsp.addContent(fid) stdscr.addstr(3, 0, "Published a File: " + fid.decode('utf-8')) stdscr.refresh() stdscr.addstr(4, 0, " ") elif key == ord('r'): for record_dict in ddsp.getResourceTable(): if record_dict['ip_addr'] == '127.0.0.1':