Back to product page

SendFile method


Sends file to remote peer.

Type

Integer.

Syntax

  • C#
  • C++
  • VB.NET
int devP2P.SendFile(IntPtr Handle, int chanid, string localfilename, string remotefilename, bool doresume);
The SendFile(Handle,chanid,localfilename,remotefilename,doresume) syntax has these parts:
HandleReference to the devP2P instance.
chanidInteger that specifies channel index.
localfilenameFull path to local file.
remotefilenamePath where to save file on remote.
doresumeDetermines if file transfer should be resumed from previous position.
Return value0 (ErrorNone) if success, otherwise negative value from Errors enumeration.

int SendFile(int chanid, char *local_filename, char *remote_filename = 0, bool resume = false);
The SendFile(chanid,local_filename,remote_filename,resume) syntax has these parts:
chanidInteger that specifies channel index.
local_filenameFull path to local file.
remote_filenamePath where to save file on remote.
resumeDetermines if file transfer should be resumed from previous position.
Return value0 (ErrorNone) if success, otherwise negative value from Errors enumeration.

Function P2P_SendFile(ByVal Handle As IntPtr, ByVal chanid As Integer, ByVal localfilename As String, ByVal remotefilename As String, ByVal doresume As Boolean) As Integer
The SendFile(Handle,chanid,localfilename,remotefilename,doresume) syntax has these parts:
HandleReference to the devP2P instance.
chanidInteger that specifies channel index.
localfilenameFull path to local file.
remotefilenamePath where to save file on remote.
doresumeDetermines if file transfer should be resumed from previous position.
Return value0 (ErrorNone) if success, otherwise negative value from Errors enumeration.

Remarks

This method will initiate sending file to remote peer. Remote side will receive FileSend event (to decide if it wants to accept the file), then one or more FileProgress events, and finally FileDone when transfer finishes.

You should use one of available 1024 channels to send this file, just make sure this channel isn't already busy with transferring other file, or channel forwarding.

Platforms

Windows
Mac OSX
Linux
BSD