client/listenerprocess.py
def start(self):
        '''
        start is called by the parent process to initialize the child process task. This method is simply the kickoff
        point of the child process, and auto contains it within a managed object
        :return: void
        '''

        epoll = select.epoll()
        epoll.register(self.__socket, (select.EPOLLIN | select.EPOLLERR | select.EPOLLHUP | select.EPOLLET))

        while self.__keepListening:
            events = epoll.poll()
            for fd, eventType in events:
                if eventType & (select.EPOLLHUP|select.EPOLLERR):
                    print("SystemError Recieving Message. Epoll Errored. Closing Descriptor")
                    epoll.unregister(fd)
                else:
                    socket = self.__connections[fd]
                    message, address = socket.recvfrom(2048)

                    encryptedMessage = message

                    #if we haven't recieved the first message yet then this one is it
                    if self.__firstMessageReceived == False:
                        self.__firstMessageReceived = True
                        # give the message first to the algorithm to determine whether we print it or not
                        writeToConsole = self.__decryptor.giveFirstMessage(encryptedMessage)

                        # check if a reply has been sent
                        if self.__replySent == False:
                            firstMessageToBeSent = self.__decryptor.getInitializationMessage()
                            # if first message does exist then send it
                            if len(firstMessageToBeSent) > 0:
                                socket.sendto(firstMessageToBeSent, address)
                            self.__replySent = True

                            # keep track of this first message
                            self.__firstMessage = encryptedMessage

                        if writeToConsole == True:
                            # if you wanted to write to console, then everything should be able to write to console
                            self.__rejectFirstMessageMatches = False
                            #if we are to write to console then decrypt the message using algorithms decryptor
                            decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                            #if the message is empty though don't bother printing it
                            if decryptedMessage != "":
                                print(decryptedMessage)
                        else:
                            # if you don't want firstMessage to write to console, assume u never want it to
                            self.__rejectFirstMessageMatches = True
                    else:
                        # drop anything that looks like the first message if rejection is set
                        if self.__rejectFirstMessageMatches:
                            if encryptedMessage != self.__firstMessage:
                                decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                                print(decryptedMessage)
                        else:
                            decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                            print(decryptedMessage)





            '''
            try:
                message, address = self.__socket.recvfrom(2048)
                encryptedMessage = message.decode()
                decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                print(decryptedMessage)
            except Exception:
                pass
            '''

        start is called by the parent process to initialize the child process task. This method is simply the kickoff
        point of the child process, and auto contains it within a managed object
        :return: void
        
start is called by the parent process to initialize the child process task. This method is simply the kickoff
point of the child process, and auto contains it within a managed object
start is called by the parent process to initialize the child process task . This method is simply the kickoff point of the child process and auto contains it within a managed object
def start(self):
        epoll = select.epoll()
        epoll.register(self.__socket, (select.EPOLLIN | select.EPOLLERR | select.EPOLLHUP | select.EPOLLET))
        while self.__keepListening:
            events = epoll.poll()
            for fd, eventType in events:
                if eventType & (select.EPOLLHUP|select.EPOLLERR):
                    print("SystemError Recieving Message. Epoll Errored. Closing Descriptor")
                    epoll.unregister(fd)
                else:
                    socket = self.__connections[fd]
                    message, address = socket.recvfrom(2048)
                    encryptedMessage = message
                    if self.__firstMessageReceived == False:
                        self.__firstMessageReceived = True
                        writeToConsole = self.__decryptor.giveFirstMessage(encryptedMessage)
                        if self.__replySent == False:
                            firstMessageToBeSent = self.__decryptor.getInitializationMessage()
                            if len(firstMessageToBeSent) > 0:
                                socket.sendto(firstMessageToBeSent, address)
                            self.__replySent = True
                            self.__firstMessage = encryptedMessage
                        if writeToConsole == True:
                            self.__rejectFirstMessageMatches = False
                            decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                            if decryptedMessage != "":
                                print(decryptedMessage)
                        else:
                            self.__rejectFirstMessageMatches = True
                    else:
                        if self.__rejectFirstMessageMatches:
                            if encryptedMessage != self.__firstMessage:
                                decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                                print(decryptedMessage)
                        else:
                            decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                            print(decryptedMessage)
def start ( self ) : epoll = select . epoll ( ) epoll . register ( self . __socket , ( select . EPOLLIN | select . EPOLLERR | select . EPOLLHUP | select . EPOLLET ) ) while self . __keepListening : events = epoll . poll ( ) for fd , eventType in events : if eventType & ( select . EPOLLHUP | select . EPOLLERR ) : print ( "SystemError Recieving Message. Epoll Errored. Closing Descriptor" ) epoll . unregister ( fd ) else : socket = self . __connections [ fd ] message , address = socket . recvfrom ( 2048 ) encryptedMessage = message if self . __firstMessageReceived == False : self . __firstMessageReceived = True writeToConsole = self . __decryptor . giveFirstMessage ( encryptedMessage ) if self . __replySent == False : firstMessageToBeSent = self . __decryptor . getInitializationMessage ( ) if len ( firstMessageToBeSent ) > 0 : socket . sendto ( firstMessageToBeSent , address ) self . __replySent = True self . __firstMessage = encryptedMessage if writeToConsole == True : self . __rejectFirstMessageMatches = False decryptedMessage = self . __decryptor . decrypt ( encryptedMessage ) if decryptedMessage != "" : print ( decryptedMessage ) else : self . __rejectFirstMessageMatches = True else : if self . __rejectFirstMessageMatches : if encryptedMessage != self . __firstMessage : decryptedMessage = self . __decryptor . decrypt ( encryptedMessage ) print ( decryptedMessage ) else : decryptedMessage = self . __decryptor . decrypt ( encryptedMessage ) print ( decryptedMessage ) '''
            try:
                message, address = self.__socket.recvfrom(2048)
                encryptedMessage = message.decode()
                decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                print(decryptedMessage)
            except Exception:
                pass
            '''
start is called by the parent process to initialize the child process task.
start is called by the parent process to initialize the child process task .
'''
        start is called by the parent process to initialize the child process task. This method is simply the kickoff
        point of the child process, and auto contains it within a managed object
        :return: void
        ''' #if we haven't recieved the first message yet then this one is it # give the message first to the algorithm to determine whether we print it or not # check if a reply has been sent # if first message does exist then send it # keep track of this first message # if you wanted to write to console, then everything should be able to write to console #if we are to write to console then decrypt the message using algorithms decryptor #if the message is empty though don't bother printing it # if you don't want firstMessage to write to console, assume u never want it to # drop anything that looks like the first message if rejection is set '''
            try:
                message, address = self.__socket.recvfrom(2048)
                encryptedMessage = message.decode()
                decryptedMessage = self.__decryptor.decrypt(encryptedMessage)
                print(decryptedMessage)
            except Exception:
                pass
            '''
None
self