Fixed compilation problems and crash when trying to send data to a
socket in the handlePings proc.