Adding socket code