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.

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().

When the client disconnects from the server, it will call to the client the OnDisconnectFromServer().

In short, I need to write code in an event-driven programming design.

Yeah, there is a way. You may learn how to do it visiting this page.