|
MessengerYouLike
|
|
This Method Allows Users to Send a file to Online Contacts
public BeginSendFile(String FilePath, String FriendUsername);
Public Sub BeginSendFile(ByVal FilePath As String, ByVal FriendUsername As String)
|
Parameters |
Description |
|
ByVal FilePath As String |
Path of the file |
|
ByVal FriendUsername As String |
Username of the Online Contact |
First the request to the user is sent and a event is fired on Friend IMClient IMSDK.IMClient.OnReceiveFileRequest
if the friend accepts [ MC.BeginFileRequestAccepted ] the file then a Port is Opened [ IMSDK.IMClient.OnFilePortOpened ] as per the property IMSDK.IMClient.DefaultFileTransferPort for the file Transfer and then the Opened Port information is sent to the user IMClient and the file transfer begins
and if rejected the user IMClient is Informed by the event IMSDK.IMClient.OnFileRequestRejected
if property IMSDK.IMClient.FileEncryption is set to true then the file transfer is encrypted the file is converted to encrypted format and sent to the IMClient and the decrypted when receive is complete
if file Transfer is canceled [ IMSDK.FileTransfer.CancelFileTransfer ] either by receiving or sending party the Temporary files or incomplete files are deleted form the local systems at both ends
Progress of the file sending can be monitored via
IMSDK.IMClient.OnFileSendTransferring
IMSDK.IMClient.OnFileSendComplete
IMSDK.IMClient.OnFileSendDisconnected
IMSDK.IMClient.OnFileSendCancelled
Progress of the file Receiving can be monitored via
IMSDK.IMClient.OnFileReceiveFiledata
IMSDK.IMClient.OnFileReceiveFileTransferComplete
IMSDK.IMClient.OnFileReceiveDisconnected
[Visual Basic] 'Create a new IMClient Dim MC as new IMSDK.IMClient 'Call the Listen Sub MC.Listen() 'Now Try to login MC.BeginLogin(TxtUsername.Text,TxtPassword.Text) 'if username and password is valid then Private Sub MC_OnLoggedin(ByVal UserObject As IMSDK.User) Handles MC.OnLoggedin Debug.WriteLine("Username logged in : " & MCUser.Username & " , " & MCUser.Password) End Sub 'if username or password is invalid then Private Sub MC_OnUsernameOrPasswordInvalid(ByVal Username As String, ByVal Password As String) Handles MC.OnUsernameOrPasswordInvalid Debug.WriteLine("Username password invalid : " & Username & " , " & Password) End Sub 'Send File MC.BeginSendFile(TxtFilePath.Text, TxtFriendUsername.Text) 'if file transfer request accepted 'Progress can be monitored via these events Private Sub MC_OnFileSendTransferring(ByVal FileTransferID As String, ByVal FileEncryption As Boolean, ByVal FriendUsername As String, ByVal FileName As String, ByVal BytesSent As Long, ByVal TotalBytesToSent As Long) Handles MC.OnFileSendTransferring Debug.WriteLine("On File Transferring - FriendUsername :" & FriendUsername & " FileName:" & FileName & " BytesSent:" & BytesSent & " TotalBytesToSent:" & TotalBytesToSent) End Sub Private Sub MC_OnFileSendComplete(ByVal FileTransferID As String, ByVal FriendUsername As String, ByVal FileName As String) Handles MC.OnFileSendComplete Debug.WriteLine("On File Send Complete - FriendUsername :" & FriendUsername & " FileName :" & FileName) End Sub 'if users Cancels the file transfer then Private Sub MC_OnFileSendCancelled(ByVal FileTransferID As String, ByVal FriendUsername As String, ByVal FileName As String) Handles MC.OnFileSendCancelled Debug.WriteLine("On File Cancelled - FileTransferID :" & FileTransferID & " FileName :" & FileName) End Sub 'After File transfer Completes or User Get Disconnected Private Sub MC_OnFileSendDisconnected(ByVal FileTransferID As String, ByVal FriendUsername As String, ByVal FileName As String) Handles MC.OnFileSendDisconnected Debug.WriteLine(" MC_OnFileSendDisconnected - FileTransferID: " & FileTransferID & " FriendUsername : " & FriendUsername & " FileName : " & FileName) End Sub 'if file Transfer Request is rejected then Private Sub MC_OnFileRequestRejected(ByVal FileTransferID As Object) Handles MC.OnFileRequestRejected Debug.WriteLine("File Request Rejected : " & FileTransferID) End Sub