Back to product page

UserDisconnected event


Fires when user disconnects from the forwarded channel.

Syntax

  • C#
  • C++
  • VB.NET
delegate void devP2P.UserDisconnectedEvent(IntPtr Handle, int forwardid, int chanid, IntPtr userhandle, int errorno);
The UserDisconnected(Handle,forwid,chanid,user,error) syntax has these parts:
HandleReference to the devP2P instance.
forwidIndex of the forwarded channel.
chanidIndex of the channel that was used by this user.
userReference to CP2PForwardUser with user details.
errorErrors value, possible error that caused user to disconnect.

void UserDisconnected(CP2P *p2p, int forwid, int chanid, CP2PForwardUser *user, Errors error);
The UserDisconnected(p2p,forwid,chanid,user,error) syntax has these parts:
p2pPointer to devP2P instance that fired the event.
forwidIndex of the forwarded channel.
chanidIndex of the channel that was used by this user.
userReference to CP2PForwardUser with user details.
errorErrors value, possible error that caused user to disconnect.

Delegate Sub P2P_UserDisconnectedEvent(ByVal Handle As IntPtr, ByVal forwardid As Integer, ByVal chanid As Integer, ByVal userhandle As IntPtr, ByVal errorno As Integer)
The UserDisconnected(Handle,forwid,chanid,user,error) syntax has these parts:
HandleReference to the devP2P instance.
forwidIndex of the forwarded channel.
chanidIndex of the channel that was used by this user.
userReference to CP2PForwardUser with user details.
errorErrors value, possible error that caused user to disconnect.

Remarks

This event is fired when user leaves the channel. At this point he will be removed from the collection of all connected users, so this is last change to access information about the user. If disconnection was result of an error, Error argument will contain description of the error.

Note that if UDP channel was used, UserDisconnected event may be result of user being idle for certain amount of seconds.

To use this event, you should implement function by yourself in the code (based on function declaration), and set devP2P.Events.UserDisconnected structure member to point to your function.

Code sample

  • C++

Platforms

Windows
Mac OSX
Linux
BSD