{"id":2020,"date":"2011-10-19T11:58:39","date_gmt":"2011-10-19T09:58:39","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=2020"},"modified":"2013-06-26T10:41:22","modified_gmt":"2013-06-26T08:41:22","slug":"specify-different-port-for-ftp","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/specify-different-port-for-ftp","title":{"rendered":"Specify different port for FTP"},"content":{"rendered":"<p>With Ftp.dll <a href=\"\/ftp\">.NET FTP component<\/a> establishing connection using default port is easy:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nclient.Connect(&quot;ftp.example.com&quot;);\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nclient.Connect(&quot;ftp.example.com&quot;)\r\n<\/pre>\n<p>If you need to <strong>specify different port<\/strong> just <strong>use overloaded<\/strong> version of Connect method:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nclient.Connect(&quot;ftp.example.com&quot;, 999);\r\n\/\/ -or-\r\nclient.Connect(&quot;ftp.example.com&quot;, 999, false);\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nclient.Connect(&quot;ftp.example.com&quot;, 999)\r\n' -or-\r\nclient.Connect(&quot;ftp.example.com&quot;, 999, False)\r\n<\/pre>\n<p>If you are using SSL:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nclient.ConnectSSL(&quot;ftp.example.com&quot;, 999);\r\n\/\/ -or-\r\nclient.Connect(&quot;ftp.example.com&quot;, 999, true);\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nclient.ConnectSSL(&quot;ftp.example.com&quot;, 999)\r\n' -or-\r\nclient.Connect(&quot;ftp.example.com&quot;, 999, True)\r\n<\/pre>\n<p>You can also <strong>specify the port range used in Active mode<\/strong>.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nclient.ActiveModePorts = new Range(1024, 1025);\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nclient.ActiveModePorts = New Range(1024, 1025)\r\n<\/pre>\n<p>You can <strong>set the IP address announced to the FTP server in Active mode<\/strong> data transfer.<br \/>\nBy default, the value of this property is IPAddress.None which means that the address of the network interface is used instead.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nclient.ActiveModeAddress = IPAddress.Parse(&quot;ftp.example.com&quot;);\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nclient.ActiveModeAddress = IPAddress.Parse(&quot;ftp.example.com&quot;)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With Ftp.dll .NET FTP component establishing connection using default port is easy: \/\/ C# client.Connect(&quot;ftp.example.com&quot;); &#8216; VB.NET client.Connect(&quot;ftp.example.com&quot;) If you need to specify different port just use overloaded version of Connect method: \/\/ C# client.Connect(&quot;ftp.example.com&quot;, 999); \/\/ -or- client.Connect(&quot;ftp.example.com&quot;, 999, false); &#8216; VB.NET client.Connect(&quot;ftp.example.com&quot;, 999) &#8216; -or- client.Connect(&quot;ftp.example.com&quot;, 999, False) If you are using SSL: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[15,22,80,24,57],"class_list":["post-2020","post","type-post","status-publish","format-standard","hentry","category-ftp-dll","tag-c","tag-ftp","tag-ftp-component","tag-ftps","tag-vb-net"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/2020"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=2020"}],"version-history":[{"count":6,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/2020\/revisions"}],"predecessor-version":[{"id":4139,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/2020\/revisions\/4139"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=2020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=2020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=2020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}