I have an app which is creating unique ids in the form of unsigned long int
s. The app needs this precision.
However, I have to send these ids in a protocol that only allows for int
s. The receiving application – of the protocol – does not need this precision. So my questions is: how can I convert an unsigned long int
to an int
, especially when the unsigned long int
is larger than an int
?
edit:
The protocol only supports int
. I would be good to know how to avoid "roll-over problems"
The application sending the message needs to know the uniqueness for a long period of time, whereas the receiver needs to know the uniqueness only over a short period of time.