public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; // For information on handling configuration changes // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. IPEndPoint port = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["AzureFTPServerEndPoint"].IPEndpoint; _ftp = new FTPServer(port); IPEndPoint passivePort = null; passivePort = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["AzureFTPServerPassiveEndPointA"].IPEndpoint; _ftp.addPassivePort(passivePort); passivePort = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["AzureFTPServerPassiveEndPointB"].IPEndpoint; _ftp.addPassivePort(passivePort); return base.OnStart(); }
public FTPServerSlave(FTPServer server, Dictionary<string, string> accounts, TcpClient connection) { this._server = server; this._accounts = accounts; this._filesystem = null; this._connection = connection; /* default active end point */ this._activeEndPoint = new IPEndPoint( ((IPEndPoint)_connection.Client.RemoteEndPoint).Address, 20); NetworkStream stream = this._connection.GetStream(); this._controlInput = new StreamReader(stream); this._controlOutput = new StreamWriter(stream); _controlOutput.AutoFlush = true; }