implemented skeleton for reading and writing sockets