コード例 #1
0
 def __init__(self, core, module):
     Server.__init__(self, core, module)
     self.default_config_name = "tarantool.cfg"
     # append additional cleanup patterns
     self.re_vardir_cleanup += [
         '*.snap', '*.xlog', '*.inprogress', '*.cfg', '*.sup'
     ]
コード例 #2
0
 def __init__(self, host='0.0.0.0', port=9012, max_connection=4):
     Server.__init__(self, host, port, max_connection)
     self.players = {}
     self.clock = Clock()
     self.delta = 0
     self.fps = 60
     self.delay = 1000 / self.fps
コード例 #3
0
    def __init__(self, server_ip_address):
        Server.__init__(server_ip_address, self.SERVER_PORT)

        self.routing_table = Message().get_bitfield()# what data structure will this be?
        self.server_ip_address = server_ip_address
        self.id = uuid.uuid4()
        self.msg = Message()
コード例 #4
0
    def __init__(self,
                 max_upload_rate=None,
                 max_download_rate=None,
                 is_seed=False):
        """
        TODO: implement the class constructor
        """
        Server.__init__(
            self, '127.0.0.1'
        )  # inherits methods from Server class, temporary inputs for ip
        # Client.__init__(self) # inherits methods from Client class
        self.status = self.PEER if not is_seed else self.SEEDER
        self.chocked = 0
        self.interested = 0
        if max_download_rate:
            self.max_download_rate = max_download_rate
        else:
            self.max_download_rate = int(
                input("Input Max Download Rate (b/s): "))
        if max_upload_rate:
            self.max_upload_rate = max_upload_rate
        else:
            self.max_upload_rate = int(input("Input Max Upload Rate (b/s): "))
        self.peer_id = None
        self.tracker_client = None
        self.peer_clients = []

        self.resource = None
        self.swarm = None
        # Queue used to hold messages for main message thread to handle
        self.tracker_message_queue = queue.Queue()
コード例 #5
0
 def __init__(self, core="tarantool"):
     Server.__init__(self, core)
     self.default_bin_name = "tarantool_box"
     self.default_config_name = "tarantool.cfg"
     self.default_init_lua_name = "init.lua"
     # append additional cleanup patterns
     self.re_vardir_cleanup += ['*.snap',
                                '*.xlog',
                                '*.inprogress',
                                '*.cfg',
                                '*.sup',
                                '*.lua']
     self.process = None
     self.config = None
     self.vardir = None
     self.valgrind_log = "valgrind.log"
     self.valgrind_sup = os.path.join("share/", "%s.sup" % ('tarantool'))
     self.init_lua = None
     self.default_suppression_name = "valgrind.sup"
     self.pidfile = None
     self.port = None
     self.binary = None
     self.is_started = False
     self.mem = False
     self.start_and_exit = False
     self.gdb = False
     self.valgrind = False
コード例 #6
0
ファイル: local.py プロジェクト: iogf/candocabot
 def __init__(self, nick):
     Server.__init__(self,
         server_address='localhost',
         port=0,
         server_name='local',
         real_name=nick,
         user_name=nick,
         nick=nick)
コード例 #7
0
    def __init__(self, *args, **kwargs):
        Server.__init__(self, *args, **kwargs)

        self.recvbuf_size = kwargs.get('recvbuf_size', 2048)

        self.epoll = epoll()
        self.epoll.register(self.sock.fileno(), EPOLLIN)
        self.conns = {}
コード例 #8
0
ファイル: peer.py プロジェクト: brian-tle/csc645-networks
 def __init__(self, server_ip_address='0.0.0.0'):
     """
     Class constructor
     :param server_ip_address: used when need to use the ip assigned by LAN
     """
     Server.__init__(self)  # inherits methods from the server
     self.server_ip_address = server_ip_address
     self.id = uuid.uuid4()  # creates unique id for the peer
コード例 #9
0
    def __init__(self,
                 listen_secure,
                 handler,
                 cert_path,
                 key_path,
                 plain_mode=0,
                 listen_plain=None,
                 handler_plain=None):

        # figure out if we need to expose an http fallback
        try:
            if plain_mode in PLAIN.values:
                self.plain_mode = plain_mode
            else:
                self.plain_mode = getattr(PLAIN, str(plain_mode).upper())
        except:
            raise Exception("unrecognized mode '{0}'".format(repr(plain_mode)))

        Server.__init__(self, listen_secure, handler)
        #print listen_secure
        #print self.socket
        # the magic that allows simple https connections
        self.socket = ssl.wrap_socket(self.socket,
                                      certfile=cert_path,
                                      keyfile=key_path,
                                      server_side=True)

        # e.g. if any https is running
        if self.plain_mode:
            if listen_plain is None:
                raise Exception(
                    "need to specify `listen_plain` arg when running dual http+https"
                )

            # CUSTOM plain mode requires a seperate, explicit handler
            if self.plain_mode == PLAIN.CUSTOM:
                if handler_plain is None:
                    raise Exception(
                        "need to specify `handler_plain` when a separate handler is desired for http"
                    )

            # use the same handler for http and https
            elif self.plain_mode == PLAIN.MIRROR:
                handler_plain = handler

            # redirect all http requests to http asap
            elif self.plain_mode == PLAIN.REDIRECT:
                handler_plain = SSLRedirectHandler

            else:
                raise Exception(
                    "shouldn't be able to get this far without a valid plain_mode???"
                )

            self.plain_server = Server(listen_plain, handler_plain)
        else:
            self.plain_server = None
コード例 #10
0
ファイル: tcpserver.py プロジェクト: scorpilix/Golemtest
 def __init__(self, config_desc, network):
     """
     Create new server
     :param ClientConfigDescriptor config_desc: config descriptor for listening port
     :param TCPNetwork network: network that server will use
     """
     Server.__init__(self, config_desc, network)
     self.cur_port = 0  # current listening port
     self.use_ipv6 = config_desc.use_ipv6 if config_desc else False
     self.ipv4_networks = ipv4_networks()
コード例 #11
0
    def __init__(self, port, bufsize):
        Server.__init__(self, port, bufsize)

        self.effort = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
        self.panda_pub = PandaPublisher()
        self.clock_sub = rospy.Subscriber("/tick", TimeReference,
                                          self.clock_callback)

        self.timestamp = None
        self.last_published_timestamp = None
コード例 #12
0
ファイル: peer.py プロジェクト: reejr-ray/ComputerNetworks
 def __init__(self):
     """
         Initializes a peer on the network
     """
     self.server = Server()
     Server.__init__(self)
     self.client = Client()
     Client.__init__(self)
     self.id = uuid.uuid4()
     self.clienthander_list = []
コード例 #13
0
 def __init__(self, server_ip_address='0.0.0.0'):
     # function calls
     self.server = Server()
     Server.__init__(self)
     self.client = Client()
     Client.__init__(self)
     self.list_of_clienthandlers = []
     self.peer_id = uuid.uuid4()
     self.peer_hash = None
     self.send_hash = {}
コード例 #14
0
 def __init__(self, core, module):
     Server.__init__(self, core, module)
     self.default_config_name = "tarantool.cfg"
     self.default_init_lua_name = "init.lua"
     # append additional cleanup patterns
     self.re_vardir_cleanup += ['*.snap',
                                '*.xlog',
                                '*.inprogress',
                                '*.cfg',
                                '*.sup',
                                '*.lua']
コード例 #15
0
 def __init__(self, max_upload_rate, max_download_rate):
     """
     TODO: implement the class constructor
     """
     Server.__init__(self)  # inherites methods from Server class
     Client.__init__(self)  # inherites methods from Client class
     self.status = self.PEER
     self.chocked = False
     self.interested = False
     self.max_download_rate = max_download_rate
     self.max_upload_rate = max_upload_rate
コード例 #16
0
ファイル: ssl_server.py プロジェクト: gbromios/gb
	def __init__(self,
			listen_secure,
			handler,
			cert_path,
			key_path,
			plain_mode    = 0,
			listen_plain  = None,
			handler_plain = None
	):

		# figure out if we need to expose an http fallback
		try:
			if plain_mode in PLAIN.values:
				self.plain_mode = plain_mode
			else:
				self.plain_mode = getattr(PLAIN, str(plain_mode).upper())
		except:
			raise Exception("unrecognized mode '{0}'".format(repr(plain_mode)))

		Server.__init__(self, listen_secure, handler)
		#print listen_secure
		#print self.socket
		# the magic that allows simple https connections
		self.socket = ssl.wrap_socket(
			self.socket,
			certfile=cert_path,
			keyfile=key_path,
			server_side=True
		)

		# e.g. if any https is running
		if self.plain_mode:
			if listen_plain is None:
				raise Exception("need to specify `listen_plain` arg when running dual http+https")

			# CUSTOM plain mode requires a seperate, explicit handler
			if self.plain_mode == PLAIN.CUSTOM:
					if handler_plain is None:
						raise Exception("need to specify `handler_plain` when a separate handler is desired for http")

			# use the same handler for http and https
			elif self.plain_mode == PLAIN.MIRROR:
					handler_plain = handler

			# redirect all http requests to http asap
			elif self.plain_mode == PLAIN.REDIRECT:
					handler_plain = SSLRedirectHandler

			else:
					raise Exception("shouldn't be able to get this far without a valid plain_mode???")

			self.plain_server = Server(listen_plain, handler_plain)
		else:
			self.plain_server = None
コード例 #17
0
ファイル: workloadGenerator.py プロジェクト: gbottari/ESSenCe
 def __init__(self):
     Server.__init__(self)
     self._detectProcessor = False
     Thread.__init__(self)
     self._startTime = 0
     self._finishTime = 0
     self._wgProgram = ''
     self.initcmd = None
     self._wgParameters = []  #parameters to start the workload generator
     self._minExecTime = 5
     self._wgPath = ''
     self._dump = None  #command dump
     self._performedCleanUp = False
コード例 #18
0
 def __init__(self, ip_address=IP_ADDRESS, port=PORT):
     """
     TODO: finish constructor implementation (if needed)
     If parameters ip_address and port are not set at the object creation time,
     you need to use the default IP address and the default port set in the class constants.
     :param ip_address:
     :param port:
     """
     self.port = port
     Server.__init__(self, port)
     self.ip = ip_address
     # the list of swarms that this tracker keeps
     self.swarms = []
コード例 #19
0
 def __init__(self, max_upload_rate, max_download_rate):
     """
     TODO: implement the class constructor
     """
     Server.__init__(self, '127.0.0.1', self.PORT) # inherites methods from Server class COULD BE WRONG TO SET LISTENING IP TO 0.0.0.0
     threading.Thread(target=self.listen, args=())
     Client.__init__(self) # inherites methods from Client class
     self.status = self.PEER
     self.chocked = False
     self.interested = False
     self.max_download_rate = max_download_rate
     self.max_upload_rate = max_upload_rate
     self.logging = Logging()
     self.swarm_clients = []
     self.myIp = "x.x.x.x"
     self.mySocketId = "00000"
コード例 #20
0
 def __init__(self, ip_address=None, port=0, file_path=None):
     """
     TODO: finish constructor implementation (if needed)
     If parameters ip_address and port are not set at the object creation time,
     you need to use the default IP address and the default port set in the class constants.
     :param ip_address:
     :param port:
     """
     self.IP_ADDRESS = ip_address or self.IP_ADDRESS
     self.PORT = port or self.PORT
     Server.__init__(self, self.IP_ADDRESS, self.PORT)
     # the list of swarms that this tracker keeps
     if file_path:
         self.swarms = self.current_swarms_or_new(file_path)
     else:
         self.swarms = self.current_swarms_or_new()
コード例 #21
0
ファイル: PT.py プロジェクト: CityU-HAN/Theano-MPI
    def __init__(self, port, config, device):
        Server.__init__(self,port=port)
        PTBase.__init__(self,config=config,device=device)
        
        #######
        
        self.info = MPI.INFO_NULL

        self.port = MPI.Open_port(self.info)
        
        self.service = 'parallel-training'
        
        MPI.Publish_name(self.service, self.info, self.port)
        
        self.worker_comm = {}
        self.worker_rank = {}
        self.first_worker_id = None
コード例 #22
0
ファイル: PT.py プロジェクト: hma02/Theano-MPI
    def __init__(self, port, config, device):
        Server.__init__(self, port=port)
        PTBase.__init__(self, config=config, device=device)

        #######

        self.info = MPI.INFO_NULL

        self.port = MPI.Open_port(self.info)

        self.service = 'parallel-training'

        MPI.Publish_name(self.service, self.info, self.port)

        self.worker_comm = {}
        self.worker_rank = {}
        self.first_worker_id = None
コード例 #23
0
ファイル: webService.py プロジェクト: Neuroinflab/BrainSlices
  def __init__(self, servicePath):
    self.serviceDir = servicePath
    self.generator = WebGenerator(os.path.join(servicePath, 'templates'))

    tileDir = os.path.join(servicePath, 'tiles')
    sourceDir = os.path.join(servicePath, 'sourceImages')
    tileBase = TileBase(db, dbPool, tileDir, sourceDir)
    userBase = UserBase(db, dbPool)
    metaBase = MetaBase(db, dbPool)

    self.images = TileServer(tileBase, metaBase)
    self.outlines = OutlineServer(os.path.join(servicePath, 'outlines'))
    self.user = UserServer(servicePath, userBase)
    self.upload = UploadServer(servicePath, tileBase) #TODO: remove servicePath after tests
    self.meta = MetaServer(metaBase, tileBase, servicePath) # tileBase as privilege manager
    self.indexer = IndexerServer(tileBase, metaBase, servicePath)

    Server.__init__(self)
コード例 #24
0
 def __init__(self, core="tarantool"):
     Server.__init__(self, core)
     self.default_bin_name = "tarantool_box"
     self.default_config_name = "tarantool.cfg"
     self.default_init_lua_name = "init.lua"
     # append additional cleanup patterns
     self.re_vardir_cleanup += [
         '*.snap', '*.xlog', '*.inprogress', '*.cfg', '*.sup', '*.lua'
     ]
     self.process = None
     self.config = None
     self.vardir = None
     self.valgrind_log = "valgrind.log"
     self.valgrind_sup = os.path.join("share/", "%s.sup" % ('tarantool'))
     self.init_lua = None
     self.default_suppression_name = "valgrind.sup"
     self.pidfile = None
     self.port = None
     self.binary = None
     self.is_started = False
     self.mem = False
     self.start_and_exit = False
     self.gdb = False
     self.valgrind = False
コード例 #25
0
ファイル: main.py プロジェクト: David-Wolgemuth/tkmessage
 def __init__(self, master):
     Server.__init__(self, master)
     Client.__init__(self, master)
     self.starting_window()
コード例 #26
0
 def __init__(self, server_ip_address):
     Server.__init__(server_ip_address, self.SERVER_PORT)
コード例 #27
0
 def __init__(self, host, port):
     """Get the socket connection object from Server class."""
     self.host = host
     self.port = port
     Server.__init__(self)
コード例 #28
0
ファイル: service.py プロジェクト: liorsol/PythonDownloader
 def __init__(self, threadNum, port=6736):
     Server.__init__(self, port)
     self.threadNum = threadNum
     self.queue = Queue()
     self.prepare_thread_pool()
コード例 #29
0
ファイル: unittest_server.py プロジェクト: cbin/tarantool
 def __init__(self, core="unittest", module="dummy"):
     Server.__init__(self, core, module)
     self.debug = False
コード例 #30
0
ファイル: ip_server.py プロジェクト: stan12138/Socket-Module
    def __init__(self, ip, port, alive_time=3000, catch_break=True):
        Server.__init__(self, ip, port, catch_break)
        self.online_device = {}
        self.server_book = {}

        self.max_alive_time = alive_time
コード例 #31
0
 def __init__(self, ip_address='127.0.0.1', port=13000):
     Server.__init__(self, ip_address, port)
     self.port = port
     self.ip = ip_address
     self.swarms = []  # the list of swarms that this tracker keeps
     self.listen()
コード例 #32
0
ファイル: main.py プロジェクト: david-wolgemuth/tkmessage
 def __init__(self, master):
     Server.__init__(self, master)
     Client.__init__(self, master)
     self.starting_window()
コード例 #33
0
ファイル: serverudp.py プロジェクト: pdegrazia/python
 def __init__(self, server_type):
     Server.__init__(self, server_type=server_type)
コード例 #34
0
 def __init__(self, addr=('0.0.0.0', 8000)):
     Server.__init__(self, addr=addr)
コード例 #35
0
 def __init__(self, server_ip_address):
     Server.__init__(server_ip_address, self.SERVER_PORT)
     self.routing_table = []
コード例 #36
0
ファイル: listenClient.py プロジェクト: cradle/manic
 def __init__(self):
     Client.__init__(self, True)
     Server.__init__(self)
コード例 #37
0
 def __init__(self, core="unittest"):
     Server.__init__(self, core)
     self.debug = False
コード例 #38
0
ファイル: cdma_server.py プロジェクト: rizsutt/elte-ik-szh
 def __init__(self, host = 'localhost', port = 10000): 
     Server.__init__(self, host, port)
     self.handlers = [self.socket, sys.stdin]
コード例 #39
0
 def __init__(self, core="unittest", module="dummy"):
     Server.__init__(self, core, module)
     self.debug = False
コード例 #40
0
ファイル: filer_server.py プロジェクト: stan12138/Filer
 def __init__(self, ip, port):
     Server.__init__(self, ip, port)
     self.info_record = {}