process handler for client and server