How to use different port?

Apr 4, 2016 at 8:27 AM
Edited Apr 5, 2016 at 11: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 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 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);
                        m_bIsConnect = true;
catch (Exception)
i also tried to config some value (DataConnectionType, EncryptionMode) but it still didn't work
Anyone can help me?