FtpClientConnection.ChunkSize 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示在文件传输协议 (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
示例输出:
区块:1
重试次数:5
服务器名称:
ServerPort:21
ServerUserName:
超时:60
UsePassiveMode: False
注解
读取或写入小区块会导致对服务器进行不太优化的往返,因为未接收或发送完整数据包。 默认值为 1 KB。 最大值为 1000 KB (1 MB) 。