Working on socket code for emulator