add server.c and a little changes