Quote:
Is there any way to say how long exactly I have to wait untill the clientId is set?


Yes, the clientid is set after the connected with server event is called or you put a while(enet_get_clientid() == -1) {wait(1);} into your code wink

Normally you start the client and a little bit later the connected with server event is called and from here you start the functions that control your game. Then you can be sure that the connection is set up correctly.

This should solve your problems. A howto of correct setting up a connection is already added to the new manual which will be released with the new version.

Code:
void start_clientserver() 
{ 
//Client-Server Modus: 
enet_init_server(2300,4,_str("")); //Initializes the server 
enet_init_client(_str("127.0.0.1"),2300,_str("")); //Initializes a client 
//which connects over the localhost with the server 
} 


This code only initializes a server and then a client and doesn't meen that the clientid is available after the client is initialized.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version