Here is a patch I wrote to the Microsoft/IBM TPM 2.0 Simulator on SourceForge:
It makes the simulator "dual stack"-it listens to both IPv4 and IPv6 connection
requests and tries to connect to a series of IP addresses (instead of the common method of
only trying the first address returned in a hostname lookup).
I also submitted this patch as issue #6 to the TPM 2.0 Simulator SourceForge project:
The patch may look weird because the original source uses a mixture of spaces and
4-character tabs (which may expand to 8 characters, depending on how you view it). The
source also has a mixture of coding styles.