How to know client disconnected from server
xzlxt720
✭✭
How do I know this client is disconnected from the server, which function to use?
0
Comments
-
To know if a client has disconnected use
protected override void OnDisconnect() { // Handles the clients disconnect from the server Log.Info("Client disconnected"); }
I have that in my Class file that inheriets from the PeerBase.0 -
There is another question, if I write the code as follows
protected override void OnDisconnect() { Log.WarnFormat("{0}:{1} OnDisconnect", this.RemoteIP, this.RemotePort); }
it always print 127.0.0.1:0, why this.RemotePort always zero ?0 -
The values are reset to defaults when the connection ends. Unluckily, this happens before OnDisconnect is called.
I guess you want to use this info for debugging purposes only?0 -
I want to know that which peer is not in my expected cases disconnect, Calculating the number of online peer interval some time0