server and message writer code