fix json error

Client crash when nothing returned from server.
fix binary search

A couple of minor bugs in binary search for message log.
Also, actually check if new nickname is already taken.
retrieve new messages properly

Make server bind to any host and port.