LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Send a request to a http server without using sockets. (https://www.linuxquestions.org/questions/programming-9/send-a-request-to-a-http-server-without-using-sockets-890548/)

jaepi 07-08-2011 03:16 AM

Send a request to a http server without using sockets.
 
Hi, is it possible to send a request to a http server without using sockets?

Guttorm 07-08-2011 03:42 AM

With Javascript, yes. Example here:

http://www.w3schools.com/Ajax/ajax_example.asp

jaepi 07-08-2011 03:49 AM

Thank you for the reply. I'm sorry, my question was incomplete. I was referring to the C language.

Guttorm 07-08-2011 04:20 AM

Don't think so. But there are of course many libraries you can use to make it simpler, for example libcurl. What's the problem with using sockets?

jaepi 07-10-2011 09:46 PM

I was thinking if is it possible to implement a http client in u-boot that will download firmware files from the http server. U-boot only supports udc protocol. Correct me if I'm wrong, http takes place in tcp/ip sockets. I'm not sure if it can perform request using the udc protocol but as far as I have researched, it is not possible. In addition, u-boot has no socket support. I would really appreciate any advice about my issue. :)

Nominal Animal 07-11-2011 04:27 AM

U-Boot has support for UDP over IP (but not TCP/IP). TFTP (Trivial File Transfer Protocol) was practically designed for this; it uses UDP/IP, and is supported by U-Boot. Is there a reason why you don't want to use TFTP?

TCP/IP requires quite a complex stack. Many of the implementations intended for embedded devices are quite restricted, for example to four TCP sockets total, with severe limitations on in-flight packets -- thus, very slow transfer rates. HTTP/1.1 is even more complex, especially if you want to communicate with arbitrary HTTP servers; in particular, the response may or may not be chunked. You can avoid most of those issues by using HTTP/1.0, but if the connection is via a proxy, further complications may occur. All it means is that the TCP/IP+HTTP stack is a complex beast, and definitely not suited in an embedded boot loader.

gnashley 07-11-2011 02:57 PM

bash can use TCP to download stuff if you compile it with the option enabled.

jaepi 07-11-2011 10:34 PM

@Nominal Animal - Thank you for the detailed reply.
"Is there a reason why you don't want to use TFTP?" - I am already using the TFTP protocol. I have my TFTP server and client up and working.
As far as I have researched, I would totally agree with your statement here -> "All it means is that the TCP/IP+HTTP stack is a complex beast, and definitely not suited in an embedded boot loader." I just wanted to know if it is propable to implement an HTTP type of client in a bootloader for file transport/file download. I think it is but it would just be too complex without sockets. TFTP is really suited for automated transfer for bootfiles between my reference board and my host pc.

Thanks for your replies. :)


All times are GMT -5. The time now is 01:52 AM.