def tick(ev): updates = network.read() if len( updates ) == 0: return dlines = data.split( "\n" ) for i in dlines: handle( edicomm.decode( i ) )
def process_message(self, msg): # TODO: Handle long data (currently unused, but support is built-in) ediparts = edicomm.decode(msg.data) ediparts[0] = ediparts[0].upper() if ediparts[0] == "USN": self.new_nick(ediparts[1])
def check_input(): global sock while True: # breakout by return a few lines below socks = select.select([sock], [], [], 0) if len(socks[0]) == 0: return try: data, addr = sock.recvfrom(1500) except socket.error: # Swallowing socket.error 10054 because UDP shouldn't f*****g care! continue data = data.strip() if data != '': print 'got data: ', data, 'from', addr try: actions.dispatch(edicomm.decode(data), addr) except edicomm.EDIException as e: sock.sendto(edicomm.encode('ERR', str(e.id), e.msg), addr)