I had a piece of code to retrieve an HTML page from Internet that worked in 2.6.3 and now it doesn't work in 2.8.0. It was built around wxURL and the snippet provided in the documentation for GetInputStream. It is actually the call to this method that is failing, returning a null pointer.
I've also noticed that the sockets sample is not working for me in 2.8.0.
I've loooked through the sources without being able to find a reason or solution. Does anybody have a workaround?. Thanks.
wxURL not working in 2.8.0
I had the same problem lately. Try moving your wxURL code into second thread. It helped in my case. Still I don't understand why
works in secondary thread, but fails to get stream in main thread.
Code: Select all
wxURL url(address);
if (url.IsOk())
{
url.GetProtocol().SetTimeout(20);
wxInputStream* stream = url.GetInputStream();
if (stream)
{
wxMessageBox(_("ok"));
} else
{
wxMessageBox(_("faild"));
}
} else
{
...
}
Warm thanks to all that so kindly replied to my initial post. None of the approaches have worked. Reading other posts I've noticed that currently it seems to exist a number of errors and unstabilities around the sockets implementation in wxWindows, and now I'm looking for some external library to do the job.
Thanks again.
Thanks again.
-
- Earned a small fee
- Posts: 21
- Joined: Sun Sep 25, 2005 7:24 am
- Location: Australia
- Contact:
I had a similar problem. I was trying to get the contents of a text document from a webserver.
The GetInputStream function returned a null pointer.
My problem was i had the calls to wxURL in a seperate thread and hadn't called wxSocketBase::Initialize() in my wxApp::OnInit() function.
That might help you (or it might not )
The GetInputStream function returned a null pointer.
My problem was i had the calls to wxURL in a seperate thread and hadn't called wxSocketBase::Initialize() in my wxApp::OnInit() function.
That might help you (or it might not )