Example #1
0
def draw_packets(stdscr, *args):
    lineh = args[0]
    mode = args[1]
    remote = args[2]

    if not remote:
        data = get_last_packet('13')
    elif remote:
        data = args[3]

    draw_columns(stdscr)


    stdscr.nodelay(True)

    try:
        for l in data:
            addstr(stdscr, lineh, 5, str(l[0]))
            addstr(stdscr, lineh, 15, str(l[1]).upper())
            addstr(stdscr, lineh, 22, str(l[2]))
            addstr(stdscr, lineh, 42, str(l[3]))
            addstr(stdscr, lineh, 62, str(l[4]).upper())
            addstr(stdscr, lineh, 72, str(l[5]))
            addstr(stdscr, lineh, 82, str(l[6]))
            addstr(stdscr, lineh, 92, str(l[7]))
            lineh += 1
            stdscr.refresh()
    except:
        pass
Example #2
0
 def handle(self):
     data = self.request.recv(10240)
     decoded_data = bytes.decode(data)
     if decoded_data == "init":
         self.request.send(decoded_data.encode('utf-8'))
     elif decoded_data == "live":
         data = get_last_packet('13')
         self.request.send(pickle.dumps(data))
     return