added socket code