?
Hallo,
PseudoCode!:
bool CMyFtp::PutFtpIP(CString server,CString user,CString pwd, CString &ip)
{
CFtpConnection* m_pFtpConnection(0);
CInternetFile *m_pInetFile(0);
CMySock ms;
for(char i(0),*pIpStr(0),Online(false); (pIpStr = ms.GetIpState(0,i,Online)); i++)
if(Online)ip=pIpStr;
if(ip.IsEmpty())//we are not online
return false;
if(!(m_pFtpConnection = CInternetSession::GetFtpConnection(server,user,pwd)))
return false;
if(!(m_pInetFile = m_pFtpConnection->OpenFile("connect.ip",GENERIC_WRITE,FTP_TRANSFER_TYPE_BINARY,1)) )
{
delete m_pFtpConnection;
return false;
}
m_pInetFile->Write(ip.GetBuffer(0),ip.GetLength()+1);//put with zero
m_pInetFile->Close();
delete m_pInetFile;
delete m_pFtpConnection;
return true;
}