Back to product page

LinkDone event


Fires when devP2P links with remote devP2P instance.

Syntax

  • C#
  • C++
  • VB.NET
delegate void devP2P.LinkDoneEvent(IntPtr Handle, string address, int port, int errorno);
The LinkDone(Handle,address,port) syntax has these parts:
HandleReference to the devP2P instance.
addressIP address of remote peer.
portPort of remote peer.

void LinkDone(CP2P *p2p, char *address, int port, Errors error);
The LinkDone(p2p,address,port) syntax has these parts:
p2pPointer to devP2P instance that fired the event.
addressPointer to allocated memory with the IP address of remote peer.
portPort of remote peer.

Delegate Sub P2P_LinkDoneEvent(ByVal Handle As IntPtr, ByVal address As String, ByVal port As Integer, ByVal errorno As Integer)
The LinkDone(Handle,address,port) syntax has these parts:
HandleReference to the devP2P instance.
addressIP address of remote peer.
portPort of remote peer.

Remarks

After remote devP2P peer is located (through Search method), and Link method was called, devP2P will try to connect to remote devP2P peer. After successful link, this event will be fired. Now you can call, for example, StartForward to begin forwarding ports between local and remote side, can send text messages etc.

Note that this event can be fired if you called Start method, and doing nothing, if remote peer initiated Link method call to you, from his side.

To obtain connection type (UDP/TCP), you can use ConnectionType property.

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

Code sample

  • C++

Platforms

Windows
Mac OSX
Linux
BSD