wrote socket_read and socket_write