source code for both server and client