+1 vote
by (160 points)

If you are on a machine with multiple IP addresses configured. Can you setup REBEX SFTP to bind to only one of those addresses. as the remote server that you are ftp'ing to allows only a connection from one of the configured IP's from your side.

Applies to: Rebex SFTP

1 Answer

0 votes
by (147k points)
Best answer

By default, Windows TCP/IP stack will choose a local address to bind to according to the local routing table, so it is not normally needed to select it manually.

If you need to override this behavior, a bit of additional work is required - you have to supply a custom Rebex.Net.ISocket implementation that is capable of binding to a specified IP and instruct Rebex SFTP to use it by calling the Sftp object's SetSocketFactory method prior to connecting (the same applies to other Rebex components).

To get started, download the sample ISocket implementation and give it a try. (The code is in C# - if you would like to have a VB.NET version instead, please let us know and we will convert it for you.) Using it from your application to bind to a specific local IP is simple. For example, to bind to the local loopback interface, do this:

using Rebex.Net;
using System.Net;

Sftp sftp = new Sftp();