fix undefined behavior
add server
add c/s protocol