Updated socket code for sending values