
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:
The UserDisconnected(Handle,forwid,chanid,user,error) syntax has these parts:
Handle | Reference to the devP2P instance. |
forwid | Index of the forwarded channel. |
chanid | Index of the channel that was used by this user. |
user | Reference to CP2PForwardUser with user details. |
error | Errors 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:
The UserDisconnected(p2p,forwid,chanid,user,error) syntax has these parts:
p2p | Pointer to devP2P instance that fired the event. |
forwid | Index of the forwarded channel. |
chanid | Index of the channel that was used by this user. |
user | Reference to CP2PForwardUser with user details. |
error | Errors 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:
The UserDisconnected(Handle,forwid,chanid,user,error) syntax has these parts:
Handle | Reference to the devP2P instance. |
forwid | Index of the forwarded channel. |
chanid | Index of the channel that was used by this user. |
user | Reference to CP2PForwardUser with user details. |
error | Errors 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++
void p2p_UserDisconnected(devP2Plib::CP2P *p2p, int forwid, int chanid, devP2Plib::CP2PForwardUser *user, devP2Plib::Errors error)
{
printf("%s] User disconnected with error %d %s\r\n", p2p->MyName, error, p2p->ErrorText(error));
}
int main(int argc, char **argv)
{
/* ... */
devP2Plib::CP2P *p1 = devP2Plib::CP2P::Create();
/* ... */
p1->Events.UserDisconnected = p2p_UserDisconnected;
/* ... */
}
{
printf("%s] User disconnected with error %d %s\r\n", p2p->MyName, error, p2p->ErrorText(error));
}
int main(int argc, char **argv)
{
/* ... */
devP2Plib::CP2P *p1 = devP2Plib::CP2P::Create();
/* ... */
p1->Events.UserDisconnected = p2p_UserDisconnected;
/* ... */
}
Platforms
WindowsMac OSX
Linux
BSD