-
Notifications
You must be signed in to change notification settings - Fork 434
Name Client
徐昊 edited this page Nov 12, 2018
·
3 revisions
- Every client has a name. By default, the name is IP Address he has.
//When the client is connected in the first time.
@Override
public void onClientConnected(IClient client, int serverPort, IClientPool clientPool) {
//the name must unique in this client pool.you'd better check it first.
if(clientPool.findByUniqueTag(/* name for this client */) == null){
client.setUniqueTag(/* name for this client */);
}
}
- 1.you can find it in client pool by name AKA
unique tag
. - 2.you can cache the name for your business logic.