
FileSend event
Fires when local devP2P starts sending file to remote.
Type
Boolean.Syntax
- C#
- C++
- VB.NET
delegate bool devP2P.FileSendEvent(IntPtr Handle, int chanid, string filename, Int64 size);
The FileSend(Handle,chanid,filename,size) syntax has these parts:
The FileSend(Handle,chanid,filename,size) syntax has these parts:
Handle | Reference to the devP2P instance. |
chanid | Index of the channel where file is being transferred. |
filename | Path to the local file. |
size | Long integer, total size of the file that will be sent. |
Return value | Return true if you accept file to be sent. Return false to cancel the transfer. |
bool FileSend(CP2P *p2p, int chanid, char *filename, int64 size);
The FileSend(p2p,chanid,filename,size) syntax has these parts:
The FileSend(p2p,chanid,filename,size) syntax has these parts:
p2p | Pointer to devP2P instance that fired the event. |
chanid | Index of the channel where file is being transferred. |
filename | Path to the local file. |
size | Long integer, total size of the file that will be sent. |
Return value | Return true if you accept file to be sent. Return false to cancel the transfer. |
Delegate Function P2P_FileSendEvent(ByVal Handle As IntPtr, ByVal chanid As Integer, ByVal filename As String, ByVal size As Int64) As Boolean
The FileSend(Handle,chanid,filename,size) syntax has these parts:
The FileSend(Handle,chanid,filename,size) syntax has these parts:
Handle | Reference to the devP2P instance. |
chanid | Index of the channel where file is being transferred. |
filename | Path to the local file. |
size | Long integer, total size of the file that will be sent. |
Return value | Return true if you accept file to be sent. Return false to cancel the transfer. |
Remarks
FileSend event fires as result of SendFile call. If all is ok on local side, this event will fire so you can get basic idea about the transfer that will be performed. If remote side accepts it (it receives FileReceive event), one or more FileProgress events will be fired as file is being transferred. When transfer finishes, FileDone will fire.To use this event, you should implement function by yourself in the code (based on function declaration), and set devP2P.Events.FileSend structure member to point to your function.
Code sample
- C++
bool p2p_FileSend(devP2Plib::CP2P *p2p, int chanid, char *filename, int64 size)
{
printf("%s] Sending file %s (%ld)\r\n", p2p->MyName, filename, (long)size);
return true;
}
int main(int argc, char **argv)
{
/* ... */
devP2Plib::CP2P *p1 = devP2Plib::CP2P::Create();
/* ... */
p1->Events.FileSend = p2p_FileSend;
/* ... */
}
{
printf("%s] Sending file %s (%ld)\r\n", p2p->MyName, filename, (long)size);
return true;
}
int main(int argc, char **argv)
{
/* ... */
devP2Plib::CP2P *p1 = devP2Plib::CP2P::Create();
/* ... */
p1->Events.FileSend = p2p_FileSend;
/* ... */
}
Platforms
WindowsMac OSX
Linux
BSD