Поделиться через


FtpClientConnection.ChunkSize Свойство

Определение

Возвращает или задает значение, указывающее минимальное число байтов, которое нужно получить или передать на сервер в ходе операции чтения/записи по протоколу FTP.

public:
 property int ChunkSize { int get(); void set(int value); };
public int ChunkSize { get; set; }
member this.ChunkSize : int with get, set
Public Property ChunkSize As Integer

Значение свойства

Целое число, содержащее минимальное число байтов для извлечения или отправки.

Примеры

Наиболее распространенным способом создания подключения клиента FTP является использование ConnectionManager. Содержит InnerObject соединение, а все свойства конкретного соединения, содержащегося в ConnectionManager коллекции, доступны через коллекцию Properties . В следующем примере кода показано создание FTP-подключения с помощью диспетчера соединений и установка свойств с помощью Properties коллекции.

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  
using Microsoft.SqlServer.Dts.Tasks.FileSystemTask;  

namespace Microsoft.SqlServer.SSIS.Samples  
{  
    class mySqlServer_Sample  
    {  
        static void Main(string[] args)  
        {  
            Package pkg = new Package();  
            FtpClientConnection ftp = null;  
            Connections conns = pkg.Connections;  
            ConnectionManager cm = conns.Add("FTP");  

            // Display the default values of the FTP connection properties.  
            // Some properties are not shown as they are write-only.  
            Console.WriteLine("ChunkSize:      {0}", cm.Properties["ChunkSize"].GetValue(cm));  
            Console.WriteLine("Retries:        {0}", cm.Properties["Retries"].GetValue(cm));  
            Console.WriteLine("ServerName:     {0}", cm.Properties["ServerName"].GetValue(cm));  
            Console.WriteLine("ServerPort:     {0}", cm.Properties["ServerPort"].GetValue(cm));  
            Console.WriteLine("ServerUserName: {0}", cm.Properties["ServerUserName"].GetValue(cm));  
            Console.WriteLine("Timeout:        {0}", cm.Properties["Timeout"].GetValue(cm));  
            Console.WriteLine("UsePassiveMode: {0}",cm.Properties["UsePassiveMode"].GetValue(cm));  

            Console.WriteLine();  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask  

Namespace Microsoft.SqlServer.SSIS.Samples  
    Class mySqlServer_Sample  
        Shared  Sub Main(ByVal args() As String)  
            Dim pkg As Package =  New Package()   
            Dim ftp As FtpClientConnection =  Nothing   
            Dim conns As Connections =  pkg.Connections   
            Dim cm As ConnectionManager =  conns.Add("FTP")   

            ' Display the default values of the FTP connection properties.  
            ' Some properties are not shown as they are write-only.  
            Console.WriteLine("ChunkSize:      {0}", cm.Properties("ChunkSize").GetValue(cm))  
            Console.WriteLine("Retries:        {0}", cm.Properties("Retries").GetValue(cm))  
            Console.WriteLine("ServerName:     {0}", cm.Properties("ServerName").GetValue(cm))  
            Console.WriteLine("ServerPort:     {0}", cm.Properties("ServerPort").GetValue(cm))  
            Console.WriteLine("ServerUserName: {0}", cm.Properties("ServerUserName").GetValue(cm))  
            Console.WriteLine("Timeout:        {0}", cm.Properties("Timeout").GetValue(cm))  
            Console.WriteLine("UsePassiveMode: {0}",cm.Properties("UsePassiveMode").GetValue(cm))  

            Console.WriteLine()  
        End Sub  
    End Class  
End Namespace  

Образец вывода:

ChunkSize: 1

Повторные попытки: 5

ServerName:

ServerPort: 21

ServerUserName:

Время ожидания: 60

UsePassiveMode: False

Комментарии

Чтение или запись в небольших блоках приводит к менее оптимизированной круговой поездке на сервер, так как полный пакет не получен или отправлен. Значение по умолчанию — 1 КБ. Максимальное значение — 1000 КБ (1 МБ).

Применяется к