You are here: MessengerYouLike.IMSDK > IMSDK Reference > IMSDK Namespace > Classes > IMClient Class > IMClient Methods > IMClient.BeginFileRequestAccepted Method
MessengerYouLike
IMClient.BeginFileRequestAccepted Method

When a Online Contacts Sends a File this method is used to Accept the File Transfer

C#
public BeginFileRequestAccepted(String FriendUsername, String FileTransferID);
Visual Basic
Public Sub BeginFileRequestAccepted(ByVal FriendUsername As String, ByVal FileTransferID As String)
Parameters 
Description 
ByVal FriendUsername As String 
Username of the Contact Who wants to sends a file 
ByVal FileTransferID As String 
FileTranferID of the File Transfer 

When File Transfer is accepted then a Port is opened based on the value of property IMSDK.IMClient.DefaultFileTransferPort then this Port information is sent to the client and File Transfer is started.

[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

 

Copyright (c) 2007. All rights reserved.