The Ming Dynasty’s Cabinet and TCP/IP Design

This article is a prequel to “The Ming Dynasty Postman of TCP/IP”, discussing how the ministers of the Ming Dynasty’s cabinet designed the TCP/IP network.
During the Tianqi period of the Ming Dynasty, Emperor Zhu Youjiao was obsessed with carpentry and heavily relied on the eunuch Wei Zhongxian, having not attended court for a long time.
The Chief Minister Ye was worried; the people across the Ming Dynasty were suffering, vast fields lay barren, and bandits and wild beasts roamed freely. The official roads that had been built were basically abandoned, and not only could they not receive reports from various regions, but after barely managing to meet the emperor yesterday, the imperial decree he requested could not reach the various prefectures and counties. The postmen were either robbed halfway or went missing!
Chief Minister Ye decided to convene a cabinet meeting to discuss how to establish a reliable, stable, and smooth mechanism for communication from the top down.
Virtual Circuit
The ministers who came to the meeting listened to Chief Minister Ye’s situation and immediately wore worried expressions. Faced with such a daunting challenge, no one was willing to speak, all were sighing and shaking their heads.
After a while, Minister Han, seeing the Chief Minister constantly signaling to him, finally spoke up: “My lords, I have an immature idea; let me share it for your judgment. The main issue now is the rampant bandits and wild beasts. I think we can send our army to stand guard along the way, every five steps a guard, every three steps a watch, to establish a reliable guarantee for the official road.”
Minister Zhu said: “Minister Han’s method is incorrect! With so many official roads in our Ming Dynasty, no matter how many soldiers we have, it won’t be enough.”
Minister Han smiled and said: “Minister Zhu, it seems you haven’t understood. I don’t mean to station guards on all the official roads, but rather to establish a connection channel!”
“Connection? What connection?” Minister Zhu said, “I’ve never heard of it.”
“If we want to communicate between the capital and Kaifeng, we will pass through many towns. We only need to send a team of soldiers to protect the road from the capital to Kaifeng, so we won’t fear those bandits and beasts. Once the communication is complete, the army can withdraw and protect another communication route. This is using soldiers to establish a connection!”
Chief Minister Ye said: “Minister Han makes a point; it can at least solve the problem. However, our main army has been sent to the northeast to deal with Nurhaci, so we need to negotiate with the towns and relay stations along the way to let them send troops to establish a safe passage with the army from the capital.”
“In this way, we can use this safe passage for each communication, which is wide and reliable, but the cost is also high. To communicate once, we need to mobilize so many soldiers and negotiate with the intermediate nodes.” Minister Zhu also learned to abstract and coined the term “intermediate node“.
Minister Han said: “Well, one more thing is that if the passage is temporarily not sending messages, it will be idle and wasted.”
Chief Minister Ye said: “That’s also unavoidable. Let’s try it for a while first.”
The Ming Dynasty's Cabinet and TCP/IP Design
(Note from Code Farmer: This is what is known as a virtual circuit, with the green part being the connection channel, and all messages sent through the same channel)
Packet Switching
The “virtual circuit” operated for half a year, and finally managed to transmit messages from top to bottom, but when Wei Zhongxian learned of it, he embellished the story and told Emperor Zhu Youjiao many bad things. The carpenter emperor was furious, angrily scolding the cabinet for wasting national manpower and resources, ordering an immediate halt.
The cabinet hated Wei Zhongxian to the core but had no choice but to stop.
That day, the emperor did not attend the morning court again, and everyone gathered together with worried faces to discuss.
Sun Chengzong, the Right Vice Minister of Rites, suddenly remembered something: “When I was patrolling the border, I heard that Yuan Chonghuan used a strange method to deliver military supplies. He did not use the army to guard the official roads, nor did he establish a safe connection channel, but completely relied on horses and mules for communication.”
“How is that possible? Horses are not human, what if they run away?”
Sun Chengzong said: “These horses are trained, carrying letters or supplies, and can travel on the official road. Whenever they reach a relay station or town, the local officials check the destination of the letters, feed the horses, and then guide them to the next official road, which is very convenient. Of course, the specific official road is determined by the local officials; they will gather various information to determine which official road has fewer bandits and beasts.”
(Note from Code Farmer: The relay station is similar to a router, needing to build a routing table to forward data packets)
“This still doesn’t solve the problem. Without soldiers to protect them on the road, the horses could be robbed or eaten by wild beasts, and the supplies would still be lost.”
Sun Chengzong said: “Yuan Chonghuan and his team thought of this too. They invented a method called retransmission on failure; if they do not receive a confirmation reply from the other party, they will resend it.”

“The cost of resending is too high, after all, it’s supplies!”

“That’s right. They usually break down a large item into smaller pieces because a horse cannot carry much, and then number each small piece. If one small piece is lost, only that numbered piece is resent. Yuan Chonghuan said they have something called the ‘Mirage Treasure Mirror’ that can retrieve lost items!”
“This is truly a treasure! How could an ordinary person have one?”
(Intermission: Thank you to the netizen who provided the idea of the Mirage Treasure Mirror; I forgot who it was, please contact me if you see this.)
Chief Minister Ye said: “However, this is an interesting idea; there is no need to establish a real connection channel beforehand, and each numbered small piece might take different paths, completely decided by the local officials of the intermediate nodes as to which path the horse will take next.”
(Note from Code Farmer: This is called packet switching)
Sun Chengzong added: “Chief Minister Ye sees it very clearly; not only are the paths different, but these small pieces may also arrive out of order (disordered). What he means is that the intermediate nodes do not promise to provide a reliable connection channel; supplies may completely be disordered, duplicated, or even lost. The so-called reliable transmission is entirely achieved by the two endpoints (for example, the capital and Kaifeng).”
The Ming Dynasty's Cabinet and TCP/IP Design
(Note from Code Farmer: The capital’s Wumen sent A1, A2 to the county government of Neixiang, and Deshengmen of the capital sent B1, B2, B3 to the Kaifeng prefecture, showing the paths of the packets)
Minister Han said: “Chief Minister, why don’t we try it too? But we need to figure out how to get the Mirage Treasure Mirror.”
Chief Minister Ye said: “We will petition the emperor to let Yuan Chonghuan come to the capital to report on his duties and bring the treasure mirror with him. This time, we must get the emperor’s support; otherwise, it will fail halfway again. I will go to the palace immediately, and everyone waits for good news.”
(The End)
PS: I will strive to write another prequel, discussing how Supervisor Yuan realized retransmission on failure.
You are only seeing the tip of the iceberg; more exciting articles can be found in the “Code Farmer Reborn” WeChat public account. Reply with “m” or “directory” to view more articles.
If you have insights to share with everyone, feel free to contribute! My contact information: WeChat: liuxinlehan QQ: 3340792577
The Ming Dynasty's Cabinet and TCP/IP Design
The public account: Code Farmer Reborn
The “Code Farmer Reborn” public account was created by a former IBM architect with 15 years of experience, sharing programming and workplace lessons.
Juejin is a high-quality technical community, covering everything from Swift to React Native, performance optimization to open-source libraries, ensuring you don’t miss any technical content in internet development. Long press the image QR code to recognize it or search for “Juejin” in major app markets to grasp all technical content.
The Ming Dynasty's Cabinet and TCP/IP Design

Leave a Comment