FTP 下传文件的有关问题,

FTP 上传文件的问题,急!
服务器端是用serv_u搭建的,客户端是自己用C++写的,在局域网内上传文件都没问题,但是如果服务器放到广域网上,用外网IP的话,上传文件时,一执行到PutFile,程序就停住了,一直过了300秒(FTP默认等待时间),返回错误12002(等待超时),在服务器上可以看到已经创建了所上传的文件,但是大小为0.下面是上传的相关代码,请高手帮我看一下到底是什么原因,谢谢!
BOOL CDecoder::UpdFile(LPCTSTR localPath,LPCTSTR serverIP,int port,LPCTSTR userName,LPCTSTR pwd,LPCTSTR remotePath,LPCTSTR fileName)
{  
  CString defServerName =serverIP;//"hexun.com";//服务器名
  CString defObjectName =remotePath;//"/upload.jsp";//保存的地址
  CInternetSession Session;
  CFtpConnection *pFtpConnection = NULL;
  TCHAR szError[MAX_PATH];
  BOOL bSuccess = TRUE; 
  CString strDebugMessage;

try
{
pFtpConnection = Session.GetFtpConnection(defServerName,userName,pwd,port);
  bSuccess = pFtpConnection->SetCurrentDirectory(defObjectName);
if(bSuccess==false)
{
bSuccess = pFtpConnection->CreateDirectory(defObjectName);
bSuccess = pFtpConnection->SetCurrentDirectory(defObjectName);
}

//pFtpConnection->SetOption
bSuccess = pFtpConnection->PutFile(localPath,fileName,FTP_TRANSFER_TYPE_ASCII);
DWORD dw = GetLastError(); 
if (GetLastError() == ERROR_INTERNET_EXTENDED_ERROR)
  {
  CHAR szError1[256];
  DWORD dwErrorSize = 256;
  DWORD dwLastErrorMsg;
  InternetGetLastResponseInfo(&dwLastErrorMsg,szError1,&dwErrorSize);  
  CString m_strTmperror = szError1;
  }
pFtpConnection->Close(); 
return bSuccess; 
}
catch (CException* e)
  {
e->GetErrorMessage(szError, MAX_PATH);
e->Delete();
AfxMessageBox(szError);
bSuccess = FALSE;
  } 
 
}

------解决方案--------------------
不是特别确定这个API是怎么发送文件的。FTP有两种连接方式,主动和被动,都很容易受到防火墙设置的影响。

你可以用Network Monitor抓一下包,看看到底你的客户端使用的是哪种模式,然后看看相关的防火墙设置是不是正确。

http://support.microsoft.com/kb/283679