simplified socket code