did most of ec, not sure why it still doesn't work, but the server does not seem to respond to messages sent outside of the while loop