Local Network Router Example
In looking for an example that is simple enough to cover in a few pages, is realistic in functionality, and can be completed with a Threading Building Blocks pipeline, a local network router came to mind. Figure 11-19 shows how a local network router used for a home is structured. (The home could be a business as well.) Here are the key points:
IP addresses within the local network, inside the home, are private. Packets leaving the local network must be modified as they go through the router.
The local network for the home has one IP address known outside the home. Packets coming back from the Internet are sent to this address. The real destination must be determined by the router and the packet must be forwarded to the appropriate home device.
Some application protocols pass address or port information inside the packet, called the payload, on top of the Transmission Control Protocol/Internet Protocol (TCP/IP). This information is used by the application to connect to the right address or port. Hence, for correct operation a router that transparently modifies the TCP/IP port or address information must also modify such information in the payload. In this example, we will only write code that can work with FTP payloads.
Figure 11-19. Local network (at home) router structural diagram
Get Intel Threading Building Blocks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.