I'm using ENet in my game and found out that the method ENetPeer::roundTripTime returns much higher RTT from the genuine value I guess. I measured RTT by my own - sending a reliable packet and getting it back took about 40 - 50 ms while ENetPeer::roundTripTime returns about 300 ms. Why is that happening? I guess the right value is 40 - 50 but why ENet gives so high RTT? It lacks documentation on this matter and I'm not sure whether it's my fault or I don't understand sth?

hmm, recently I thought that maybe the value returned by ENetPeer::roundTripTime divided by 8 will be the genuine RTT? It would match the RTT measured by myself. Maybe it's senseless but when creating a host in the tutorial:

The bandwidth is divided by 8 because it translates from "bits per second" to "bytes per second." That probably has nothing to do with the RTT.

Have you read the code that calculates RTT within ENet and figured out how it's calculated? It may start with some high guess, and then successively improve that guess as traffic flows, which means it may take a time to get a good value. (This is just speculation on my part -- I haven't used/read it personally.)

hplus, you are great! Thanks a lot for your tip! It's highly dubious that I could figure this out soon enough and you saved my time and nerves. Indeed, it turned out that the right RTT is calculated over the course of time. I measured ENetPeer::roundTripTime after being connected for 1 sec and after being connected for 10 seconds. The results were alright in the second case - it seems 1 second isn't enough to calculate RTT appropriately in ENet.

Anyway, I understood that it was translated from bits to bytes per sec but the commented lines confused me, for example:

In this case, "K" is 2^10 == 1024. Which is actually 57344, so the comment is wrong anyway.

This has to do with how asynchronous serial systems were designed a long time ago, with a base baud (line change) rate of 75 baud, then 300 baud, then 1200 baud etc. 57600 is 48 times 1200, so it's a common serial port speed in asynchronous serial ports. Meanwhile, once modems went above 2400 bps or so, they started to use advanced signal processing to send more than just "1" and "0" in a single line state change. up to 14400 bps, they used QAM, and over that, "trellis" coding. You can Google for "V.34" and "V.90" for more historical arcana :-)

The "56 kbps" modems were actually sending at a rate approximating 56,000 bits per second when working at full output power on clean lines, but that was actually not standards compliant and the transmission rate was limited in actuality to 53,300 bps downstream. (Upstream was typically limited to 33.6 kbps.) To drive them, you'd typically use a 57600 (or faster) baud rate on your serial port. The inclusion of 57600 may have been a confounding of the two similar speeds on the part of the original author.

That being said, those are some pretty low limits to use for games of today. Modem games do not support FPS play for 20 players. You'll want to bump up those numbers with the stated goals of your game, and require all players to have at least some kind of "broadband" connection.