Esempio n. 1
0
    def __init__(self,
                 host,
                 remote,
                 friend,
                 name,
                 state,
                 close_pipe,
                 get_pipe,
                 show=True):
        super().__init__()

        self.state = state
        self.host = host
        self.remote = remote
        self.friend = friend
        self.close_pipe = close_pipe
        self.name = name
        self.get_pipe = get_pipe
        self.message_pipe_get, self.message_pipe_send = Pipe(False)

        send = GenericThread(self.wait_send)
        recv = GenericThread(self.wait_receive)
        send.start()
        recv.start()

        self.initUI(show)
Esempio n. 2
0
def listen_thread(host, state, new_chat_pipe):
    """ Thread that awaits incoming connection and starts a new thread to
        handle incoming connections"""
    logging.debug("Listen thread started")
    listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    listen_socket.bind(host)

    listen_socket.listen(5)
    listen_socket.setblocking(0)
    while True:
        inputready, _, _ = select.select([listen_socket], [], [], 0)
        if inputready:
            client_socket, _ = listen_socket.accept()
            cthread = GenericThread(get_message, client_socket, state,
                                    new_chat_pipe)
            cthread.start()
        time.sleep(0.1)
    logging.debug("Listen thread shutting down")
Esempio n. 3
0
def listen_thread(host, state, new_chat_pipe):
    """ Thread that awaits incoming connection and starts a new thread to
        handle incoming connections"""
    logging.debug("Listen thread started")
    listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    listen_socket.bind(host)

    listen_socket.listen(5)
    listen_socket.setblocking(0)
    while True:
        inputready, _, _ = select.select([listen_socket], [], [], 0)
        if inputready:
            client_socket, _ = listen_socket.accept()
            cthread = GenericThread(get_message, client_socket, state,
                                    new_chat_pipe)
            cthread.start()
        time.sleep(0.1)
    logging.debug("Listen thread shutting down")
Esempio n. 4
0
    def __init__(self, host, remote, friend, name, state,
                 close_pipe, get_pipe, show=True):
        super().__init__()

        self.state = state
        self.host = host
        self.remote = remote
        self.friend = friend
        self.close_pipe = close_pipe
        self.name = name
        self.get_pipe = get_pipe
        self.message_pipe_get, self.message_pipe_send = Pipe(False)

        send = GenericThread(self.wait_send)
        recv = GenericThread(self.wait_receive)
        send.start()
        recv.start()

        self.initUI(show)