How to use different port?

Apr 4, 2016 at 7:27 AM
Edited Apr 5, 2016 at 10:46 AM
UPDATE: Sorry for my fault, i re checked my app again and have no problem with port :P

i made a ftp application with system.net.ftpclient library and have no problem with port 21.
But now i need to use random port.
for testing, I use IIS to create a ftp site with port number 34 (no SSL). I use window explorer and try to enter ftp://192.168.x.xxx:34+username+password and it was ok to connect, but when i set port=34 in application and it didn't work. Here is my code:
 using (FtpClient conn = new FtpClient())
                {
                    conn.Host = UserSettings.m_sHostIP;
                    conn.Port = int.Parse(tbPort.Text);
                    //conn.DataConnectionType = FtpDataConnectionType.PASV;
                    //conn.EncryptionMode = FtpEncryptionMode.Implicit;
                    conn.Credentials = new NetworkCredential(UserSettings.m_sUser, UserSettings.m_sPassword);
                    try
                    {
                        conn.Connect();
                        m_bIsConnect = true;
                    }
catch (Exception)
{
}
}
i also tried to config some value (DataConnectionType, EncryptionMode) but it still didn't work
Anyone can help me?