oracle.py 588 B

12345678910111213141516171819
  1. from connection.broadcast import BroadcastServer
  2. from connection.socket import SocketServer
  3. from .oracleParser import OracleParser
  4. import random
  5. import os
  6. class Oracle():
  7. def __init__(self,broadcast, broadcastPort):
  8. self.id = os.urandom(32)
  9. self.socketPort = int(random.random()*50000+1024)
  10. self.parser = OracleParser(self) #,socketPort=socketPort
  11. self.b = BroadcastServer(broadcastPort=broadcastPort , parser= self.parser,id=self.id)
  12. print("Done")
  13. self.s = SocketServer(self.socketPort , parser= self.parser , id=self.id)