- Home /
Is there a way to notify to the app once client has connected to server?
Once the client has successfully connected to the server, the server and the client needs to know that the connection has gone through.
I would like to know how to notify or let the app know that a client has connected to the server and would like to move on. The method that I am thinking of is a blocking function that yields if there is no connection, and returns once the connection has gone through.
If this blocking call is not the best way, then what is the recommended way of doing this? Providing a lead for research (not necessarily a link) would be very helpful in learning this process.
Thanks in advance.
Answer by asperatology · May 25, 2015 at 06:07 AM
I think I found the answers. Apparently, the codes involved are not designed like C++.
When the client connects to the server, it will call to the client the OnConnectedToServer().
http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnConnectedToServer.html
When the client disconnects from the server, it will call to the client the OnDisconnectFromServer().
http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnDisconnectedFromServer.html
In short, I need to write code in an event-driven programming design.
Answer by MariaDPettiford · Oct 04, 2017 at 08:51 AM
Yeah, there is a way. You may learn how to do it visiting this page.
Your answer
Follow this Question
Related Questions
How to watch in client applications what it is happening in the server one? 0 Answers
Creating a multiplayer game. 1 Answer
Networking 0 Answers
Seperate server - client 2 Answers