Modifications in server.

Added switch in send func.