More socket binary handling with debug left in for now.