The Server will manage the ids and send them to the clients... It will start with 0 as usual for the server and 1+ for the clients. Server: 0 <- started a new empty server Client: 1 <- a client connected Client: 2 <- a second client connected ...
Not very hard, IDK wheres your actual problem. I would also suggest to use ANet, I simply love it