Attribute VB_Name = "modFileTransfer"
Option Explicit

Public Type T_FILE_TRANSFER_RECEIVE
    Destination     As String
    From            As String
    frmReceive      As frmReceiving
End Type

Public Const FT_BUFFER_SIZE = 5734  'CHANGE THIS IF YOU NEED TO
Public Const FT_USE_PORT = 2168      'CHANGE THIS IF YOU NEED TO

Private m_oReceiveForms()  As T_FILE_TRANSFER_RECEIVE
Private m_lReceiveFormsCount As Long

Public Function ConnectRequest(ByVal requestID As Long) As Long
    Dim bIsFound As Boolean
    Dim I As Long
    bIsFound = False
    For I = 0 To (m_lReceiveFormsCount - 1)
        If m_oReceiveForms(I).frmReceive Is Nothing Then
            bIsFound = True
            Exit For
        End If
    Next I
    If bIsFound = False Then
        m_lReceiveFormsCount = m_lReceiveFormsCount + 1
        ReDim Preserve m_oReceiveForms(0 To (m_lReceiveFormsCount - 1))
    End If
    Set m_oReceiveForms(I).frmReceive = New frmReceiving
    m_oReceiveForms(I).frmReceive.Prepare I, requestID
    ConnectRequest = I
End Function

Public Sub CloseConnect(ByVal Index As Long)
    If Index >= 0 And Index < m_lReceiveFormsCount Then
        Unload m_oReceiveForms(Index).frmReceive
        Set m_oReceiveForms(Index).frmReceive = Nothing
    End If
End Sub
