Hi Richard
I modified your code (and published it here http://mbed.org/users/mbed714/programs/cig_httpclient2/lrzskc):
- made it DHCP (for convenience on my network and also assigns gateway and DNS for connection to mbed server)
- took out some printf lines in TCPSocket (for recv and checkInst methods)
- modified it to do "callback" get to mbed hello.txt and print the result
The result is this:
Debug
Setup OK
Send message
Enter TCPSocket::connect()
!m_pNetTcpSocket
Enter TCPSocket::onNetTcpSpcketEvent()
Enter TCPSocket::send()
Enter TCPSocket::send()
Enter TCPSocket::onNetTcpSpcketEvent()
Enter TCPSocket::onNetTcpSpcketEvent()
HTTPGetCallbackEvent->Result: 200
Result ok : Hello world!
Enter TCPSocket::resetOnEvent()
Enter TCPSocket::close()
Enter TCPSocket::close()
This seems to work with the get from the mbed server. It's quite possible your server responds differently from the mbed server, and it breaks the httpclient.
The httpclient was developed and tested using a limited number of servers (not like Internet Explorer one would imagine), so there is no reason it would work in every possible case.
In terms of debugging, I suggest you get an example working with your mbed (like I've just done), and then work out what the difference is between your working example and trying to connect to your particular server. The server may be doing something the httpclient is not expecting, and since the client is based on a state machine it will never complete.
You've got the idea with throwing in the printf for debugging purposes. You could increase your USB serial speed to make sure you don't slow down if you are printing a lot.
Regards
Daniel
PS To increase USB serial speed add this declaration:
Then add this at the top of your main() method:
Don't forget to change the baud rate on your terminal program.
Hi guys,
I have to face the following problem while playing around with the HTTPClient class. I want to send a non-blocking HTTP get(...) to a device(btw. blocking works fine) as shown in main.cpp /media/uploads/mr_q/main.txt
On wireshark I even cannot see any broadcast/ARP at all. Any idea what is going wrong here?
Best wishes