Esempio n. 1
0
    def setup_server(self):
        super(ForwarderService, self).setup_server()

        # Create an event for stopping the handle loop
        self.stopped = gEvent()

        # Create and bind the listener socket
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

        # If the server is not virtual, bind and listen to the
        # specified address/port
        if not self.virtual:
            sock.bind((self.listener_address, self.listener_port))
            sock.listen(self.backlog)
            self.listener = StreamSocket(sock)
Esempio n. 2
0
	def __init__(self,parent,name):
		if self.passive is None:
			self.passive = (self.__class__ is Monitor)
		if self.send_check_event is None:
			self.send_check_event = self.passive
		if self.queue_len is not None:
			if self.queue_len == 0:
				self.watcher = Channel()
			else:
				self.watcher = Queue(self.queue_len)
		self.running = gEvent()
		try:
			self.parent = parent.parent
		except AttributeError:
			pass
		super(Monitor,self).__init__(*name)
Esempio n. 3
0
    def setup_server(self):
        super(ForwarderService, self).setup_server()

        # Create an event for stopping the handle loop
        self.stopped = gEvent()

        # Create and bind the listener socket
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

        # If the server is not virtual, bind and listen to the
        # specified address/port
        if not self.virtual:
            sock.bind((self.listener_address, self.listener_port))
            sock.listen(self.backlog)
            self.listener = StreamSocket(sock)