make the read socket subroutine