working code. Occasional hangups resulting from dropped packets