You're sending infinitely increasing data. Maybe it's because "while True"
think of a way to reformat this 
    msg = bytes(f"{len(msg):<{HEADERSIZE}}", 'utf-8')+msg
while True:
    r = mouse.position
    print(r)
    t = mouse.press
    #print(r, t)
    msg = pickle.dumps(r)
as I see these two highlighted lines are handling sending the mouse position. They should stay intact, but you can think of a way to move other lines outside the while loop