socket print exceptions handling