added server thread function

added server thread function