MirrorNetworking / Telepathy

Simple, message based, MMO Scale TCP networking in C#. And no magic.
MIT License
1.17k stars 136 forks source link

Id connection #120

Closed erimeurer closed 2 years ago

erimeurer commented 2 years ago

When connection is made increasing connection id is created, what happens if this value overflows an int? himself Does telepathy do any resets?

visualbruno commented 2 years ago

When connection is made increasing connection id is created, what happens if this value overflows an int? himself Does telepathy do any resets?

If I'm not wrong, in C#, when you reach the upper bound of an integer and you increase it, it becomes the lower bound, so -2147483648.

You can try this code: int iValue = int.MaxValue; iValue++;

MrGadget1024 commented 2 years ago

It does not roll over but int.maxValue = 2147483647 so even at one new connection per second it'd take 68 years to exhaust them all. No server would be up that long.

Close this.