Back to product page

UserConnected event


Fires when user connects to forwarding channel.

Type

Boolean.

Syntax

  • C#
  • C++
  • VB.NET
delegate bool devP2P.UserConnectedEvent(IntPtr Handle, int forwardid, int chanid, IntPtr userhandle);
The UserConnected(Handle,forwid,chanid,user) syntax has these parts:
HandleReference to the devP2P instance.
forwidIndex of the forwarded channel.
chanidIndex of the channel that user will use.
userReference to CP2PForwardUser with user details.
Return valueReturn true if you accept the user, or False to disconnect him.

bool UserConnected(CP2P *p2p, int forwid, int chanid, CP2PForwardUser *user);
The UserConnected(p2p,forwid,chanid,user) syntax has these parts:
p2pPointer to devP2P instance that fired the event.
forwidIndex of the forwarded channel.
chanidIndex of the channel that user will use.
userReference to CP2PForwardUser with user details.
Return valueReturn true if you accept the user, or False to disconnect him.

Delegate Function P2P_UserConnectedEvent(ByVal Handle As IntPtr, ByVal forwardid As Integer, ByVal chanid As Integer, ByVal userhandle As IntPtr) As Boolean
The UserConnected(Handle,forwid,chanid,user) syntax has these parts:
HandleReference to the devP2P instance.
forwidIndex of the forwarded channel.
chanidIndex of the channel that user will use.
userReference to CP2PForwardUser with user details.
Return valueReturn true if you accept the user, or False to disconnect him.

Remarks

UserConnected event is fired after you have allowed user to connect and use forwarding they have chosen. From this point, user will be communicating with remote service through encrypted channel.
There will be no further interference between devP2P and the user - all his data will be forwarded to remote devP2P peer, and vice versa. When user disconnects, UserDisconnected event will be fired.

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

Code sample

  • C++

Platforms

Windows
Mac OSX
Linux
BSD