| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. http, socket #3070 Posted by: lea 2003-12-13 17:33:20 | Hi!
I have problems recieving a webpage from a server. Because wxURL etc. doesn't work with threads i have to do the work myself.
I have:
wxString result;
wxString request; request += "GET / HTTP/1.0"; request += "Host: myurl.de";
wxIPV4address addr; addr.Hostname("myurl.de"); addr.Service(80);
wxSocketClient *m_sock = new wxSocketClient(wxSOCKET_BLOCK | wxSOCKET_WAITALL);
m_sock->Connect(addr, true);
if(!m_sock->WaitForRead(10,10)) { //Error: no data }
wxChar buffer[128]; do { m_sock->Read(buffer, 127); result.Append(buffer); } while(m_sock->LastCount() >= 127);
This seemes to work, but the server does not answer, the WaitForRead fails. What is my problem?
Thx.
Post Edited (12-13-03 17:35) | 2. Re: http, socket #3076 Posted by: lea 2003-12-14 00:31:29 | Hm, maybe i have to wait with a wxServerSocket on port 80? | 3. Re: http, socket #3092 Posted by: upCASE 2003-12-15 21:26:35 | Hi! I'll try that later, but it should work. Is the host local? If you've got no server running the host will be found but nothing can be returned since no service runs on port 80. But if it's a "real" webserver it should work. as I said, I'm going to try it out. I'm currently working on something similar to get websites and scan them for any links. Believe it or not: I'm going to be the first one with a map of the web :)
upcaseupCASE ----------------------------------- If it was hard to write, it should be hard to read!- Do. Or do not. There is no try! | 4. Re: http, socket #3094 Posted by: lea 2003-12-16 13:52:32 | A map of the web? Good luck :)! The server ist a standard-webserver and always online (not localhost). I simply have no idea, why that does not work, maybe a bug in wxWindows again. Btw. the code runs in the entry-method of a thread, i hope i can use sockets in a thread-context... | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|