How do you protect the general from a cannon attack in xiangqi?
These answers restate the rules implemented by our open-source engine, which follows the WXF laws and is regression-tested against the official 110-diagram repetition casebook. Where an answer refers to a specific position, that position lives on the linked reference page, where the build verifies it against the engine before publishing.
Direct answer
The most reliable defence is controlling the screens: avoid leaving a single piece sitting on the line between an enemy cannon and your general, since that piece is exactly what turns the cannon's threat on. Keeping a solid advisor and elephant structure on the central file also denies the cannon the clean approach it needs.
The specific danger of the hollow cannon
An enemy cannon aimed straight down the central file at your general, with nothing at all in between, isn't check yet, but it becomes devastating the instant any piece, yours or theirs, lands on that file. Watch every move for whether it hands the opponent a screen on that file, even a move that looks completely unrelated.
Removing an existing threat
If a cannon is already checking you through a screen, you have an option a chariot check doesn't offer: removing the screen itself switches the check off without touching the cannon or moving your general at all, often the cheapest way out.
Related questions
Is keeping both advisors enough protection on its own?
It helps a great deal but isn't a complete defence by itself; watch the actual files and screens, not just piece count.
Can I block a cannon's threat with my own advancing piece safely?
Sometimes, but check first whether that piece becomes the exact screen the cannon needed.