some code snippets for a server