Error in protocol details on wiki
The protocol information on the wiki https://github.com/esnet/iperf/wiki/IperfProtocolStates is incorrect. It states "There is also a mini protocol for each stream: on initial connection, the client sends the test's 37-byte cookie. After that, the stream just gets uninterpreted data.".
In UDP mode at least (haven't looked at TCP), looking at iperf_udp.c:90, it seems the actual packet protocol is:
uint32 time_sec uint32 time_usec uint64 sequence (padded out with random/ignored data after this)
I also see no evidence of the cookie being sent in any of these packets.
Actually it seems the sequence number is sometimes 32 bit, i'm not clear on how it determines which code path to use.
I also see no evidence of the cookie being sent in any of these packets.
I believe you are right that the cookie is send on stream creation only for TCP and SCTP, but not for UDP. I see that the blog was last updated in 2014, so I wonder if it is still maintained.
Actually it seems the sequence number is sometimes 32 bit, i'm not clear on how it determines which code path to use.
As you found, the UDP packets start with an header that includes seconds, micro-seconds, packet-number. Seconds and micro-seconds are 32 bits are the sending time and are used for calculating the jitter.
The packet-number size is set per test and can be either 32 (default) or 64 bits if the --udp-counters-64bit option is set. It allows to detect packets that were not received or packets that are received not in order, mainly for calculating the "lost datagrams" statistic.