catcing socket exception and receive and error