Back to product page

DataReceived event


Fires when data is received from remote.

Syntax

  • C#
  • C++
  • VB.NET
delegate void devP2P.DataReceivedEvent(IntPtr Handle, int chanid, String data, int len);
The DataReceived(Handle,chanid,data,len) syntax has these parts:
HandleReference to the devP2P instance.
chanidIndex of the channel where data arrived.
dataString with incoming data.
lenSize of incoming data.

void DataReceived(CP2P *p2p, int chanid, char *data, int len);
The DataReceived(p2p,chanid,data,len) syntax has these parts:
p2pPointer to devP2P instance that fired the event.
chanidIndex of the channel where data arrived.
dataPointer to buffer in memory with the data.
lenSize of the memory buffer.

Delegate Sub P2P_DataReceivedEvent(ByVal Handle As IntPtr, ByVal chanid As Integer, ByVal data As String, ByVal len As Integer)
The DataReceived(Handle,chanid,data,len) syntax has these parts:
HandleReference to the devP2P instance.
chanidIndex of the channel where data arrived.
dataString with incoming data.
lenSize of incoming data.

Remarks

DataReceived event will fire as result of remote peer's SendData method call. When data arrives, devP2P will provide it through this event.

If you prefer to send/receive text messages, use SendText method and TextReceived event instead.

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

Code sample

  • C++

Platforms

Windows
Mac OSX
Linux
BSD