Back to product page

FileReceive event


Fires when remote devP2P wants to send us a file.

Type

Boolean.

Syntax

  • C#
  • C++
  • VB.NET
delegate bool devP2P.FileReceiveEvent(IntPtr Handle, int chanid, string filename, Int64 size);
The FileReceive(Handle,chanid,filename,size) syntax has these parts:
HandleReference to the devP2P instance.
chanidIndex of the channel where file is being transferred.
filenamePath where file will be saved.
sizeLong integer, total size of the file that will be received.
Return valueReturn true if you accept file to be received. Return false to cancel the transfer.

bool FileReceive(CP2P *p2p, int chanid, char *filename, int64 size);
The FileReceive(p2p,chanid,filename,size) syntax has these parts:
p2pPointer to devP2P instance that fired the event.
chanidIndex of the channel where file is being transferred.
filenamePath where file will be saved.
sizeLong integer, total size of the file that will be received.
Return valueReturn true if you accept file to be received. Return false to cancel the transfer.

Delegate Function P2P_FileReceiveEvent(ByVal Handle As IntPtr, ByVal chanid As Integer, ByVal filename As String, ByVal size As Int64) As Boolean
The FileReceive(Handle,chanid,filename,size) syntax has these parts:
HandleReference to the devP2P instance.
chanidIndex of the channel where file is being transferred.
filenamePath where file will be saved.
sizeLong integer, total size of the file that will be received.
Return valueReturn true if you accept file to be received. Return false to cancel the transfer.

Remarks

FileReceive event fires when remote devP2P peer wants to send us a file, and we have to decide if we will accept it or not. Event provides only filename (which you can change), and size of the file that is expected to arrive. If you return true, transfer will proceed. During the transfer, one or more FileProgress events will fire, and when transfer completes FileDone will fire.

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

Code sample

  • C++

Platforms

Windows
Mac OSX
Linux
BSD