Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading 从不同线程调用wxHTTP::GetInputStream()会导致wxPROTO\u NETERR_Multithreading_Http_Inputstream_Wxwidgets - Fatal编程技术网

Multithreading 从不同线程调用wxHTTP::GetInputStream()会导致wxPROTO\u NETERR

Multithreading 从不同线程调用wxHTTP::GetInputStream()会导致wxPROTO\u NETERR,multithreading,http,inputstream,wxwidgets,Multithreading,Http,Inputstream,Wxwidgets,下面是一个示例代码: wxHTTP HTTP; HTTP.SetHeader(_T("Content-type"), _T("application/octet-stream")); HTTP.SetTimeout(10); while (!HTTP.Connect(DownloadServer)) wxSleep(5); wxApp::IsMainLoopRunning(); std::vector<wxString> FileRecordsToDownload;

下面是一个示例代码:

wxHTTP HTTP;
HTTP.SetHeader(_T("Content-type"), _T("application/octet-stream"));
HTTP.SetTimeout(10);

while (!HTTP.Connect(DownloadServer))
    wxSleep(5);

wxApp::IsMainLoopRunning();

std::vector<wxString> FileRecordsToDownload;

{
    wxInputStream* p_HttpStream = p_HttpStream = HTTP.GetInputStream(DownloadDirectory + "TestFile.txt");
    ...
}

因此,问题还没有结束,如果有人知道问题的根源,请发表评论。

您的平台/编译器和wx版本是什么?构建wx时是否使用了任何非默认配置?我看到您正在尝试使用“DownloadsServer”-也许使用wxFTP会更好?您在什么时候调用wxSocketBase::Initialize()?能否确保在创建次线程之前调用它。
wxInputStream* p_HttpStream = p_HttpStream = HTTP.GetInputStream(DownloadDirectory + "TestFile.txt");

while (HTTP.GetError() != wxPROTO_NOERR)
{
    wxSleep(1);
    p_HttpStream = HTTP.GetInputStream(DownloadDirectory + "TestFile.txt");
}