def __init__(self, hostname):
     self.hostname = hostname
     self.buff = ''
     self.outsock, self.out_fileno = self.create_sock(IN)
     
     self.insock, self.in_fileno = self.create_sock(OUT)
     
     self.generator = receivable(self.insock)
     
     self.out_messages = []
     
     self.in_messages = []     
     self.accepted = False   
Beispiel #2
0
    def __init__(self, hostname):
        self.hostname = hostname
        self.buff = ''
        self.outsock, self.out_fileno = self.create_sock(IN)

        self.insock, self.in_fileno = self.create_sock(OUT)

        self.generator = receivable(self.insock)

        self.out_messages = []

        self.in_messages = []
        self.accepted = False
    def _accept_client(self, insock, outsock):
        "регистрация клиента, после того как он подключился к обоим сокетам"

        client_name = 'player_%s' % self.client_counter
        self.client_counter += 1
        
        self.clients[client_name] = client_tuple(insock, outsock, receivable(insock))
        
        insock_fileno = insock.fileno()
        outsock_fileno = outsock.fileno()
        
        self.infilenos[insock_fileno] = client_name
        self.outfilenos[outsock_fileno] = client_name
        
        self._register_in(insock_fileno)

        print_log('accepting_client %s' % client_name)

        #реагируем на появление нового клиента
        self._accepted.put_nowait(client_name)
Beispiel #4
0
    def _accept_client(self, insock, outsock):
        "регистрация клиента, после того как он подключился к обоим сокетам"

        client_name = 'player_%s' % self.client_counter
        self.client_counter += 1

        self.clients[client_name] = client_tuple(insock, outsock,
                                                 receivable(insock))

        insock_fileno = insock.fileno()
        outsock_fileno = outsock.fileno()

        self.infilenos[insock_fileno] = client_name
        self.outfilenos[outsock_fileno] = client_name

        self._register_in(insock_fileno)

        print_log('accepting_client %s' % client_name)

        #реагируем на появление нового клиента
        self._accepted.put_nowait(client_name)