catch socket exceptions