本文整理汇总了C++中Downloader::content方法的典型用法代码示例。如果您正苦于以下问题:C++ Downloader::content方法的具体用法?C++ Downloader::content怎么用?C++ Downloader::content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Downloader
的用法示例。
在下文中一共展示了Downloader::content方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
bool ReportDialog::Run(int step)
{
wxString output;
if( step == 0 )
{
// Do the tests
m_Done = false;
m_Output->Clear();
m_Output->AppendText( wxString(TPTEST_VERSION_STRING) );
m_Output->AppendText( wxT("\n") );
m_Output->AppendText( wxString(wxDateTime::Now().Format(wxT("%Y-%m-%d %H:%M:%S"))) );
m_Output->AppendText( wxT("\n") );
m_Output->AppendText( wxT("\n") );
#ifdef WIN32
// OS information
OSInfo osinfo;
std::string str_osinfo = osinfo.GetOSInfoString();
if (str_osinfo.length() < 1) {
m_Output->AppendText( wxString(wxT("[Failed to get OS version info]\n")) );
}
else {
m_Output->AppendText( wxString( FROMCSTR(str_osinfo.c_str()) ) );
}
#endif
m_stepDone = true;
}
else if( step == 1 )
{
// Report TCP Window size
TcpWindowSize tcpwsz;
output = FROMCSTR(tcpwsz.GetStr());
m_Output->AppendText( wxString(output) );
m_stepDone = true;
}
else if( step == 2 )
{
// External IP
Downloader *dl = new Downloader();
dl->downloadFile( TOCSTR(wxT("http://ghn.se/cgi-bin/whatsmyip")) );
if( dl->content() != NULL )
{
m_Output->AppendText( wxString( wxT("External IP Address: ") ) );
m_Output->AppendText( FROMCSTR(dl->content()) );
}
else
{
m_Output->AppendText( wxString(wxT("Cannot determine external IP. No connection to TPTEST host.\n\n") ) );
}
delete dl;
m_stepDone = true;
}
else if( step == 3 )
{
// ifconfig
wxString cmd;
#ifdef WIN32
cmd << wxT("ipconfig /all");
#endif
#ifdef MACOSX
cmd << wxT("ifconfig");
#endif
m_proc = new wxProcess(this, wxID_REPORT_PROC);
m_proc->Redirect();
if( wxExecute( cmd, wxEXEC_ASYNC, m_proc ) > 0 )
{
m_proc_running = true;
m_procIn = m_proc->GetInputStream();
}
else
{
this->m_Output->AppendText( wxT("Kan inte k�ra ifconfig.\n\n") );
m_stepDone = true;
m_stepError = true;
}
}
else if( step == 4 )
{
// netstat
wxString cmd;
#ifdef WIN32
cmd << wxT("netstat -na");
#endif
#ifdef MACOSX
cmd << wxT("netstat -nafinet");
#endif
m_proc = new wxProcess(this, wxID_REPORT_PROC);
m_proc->Redirect();
if( wxExecute( cmd, wxEXEC_ASYNC, m_proc ) > 0 )
{
m_proc_running = true;
m_procIn = m_proc->GetInputStream();
//.........这里部分代码省略.........