Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does libcurl able to send a http message over UDP?

Tags:

c++

c

curl

udp

libcurl

I developed a program that makes parameters tracking. I want to inform a server with a http message over udp when a parameter value changes.

I want to use libcurl for that. Does libcurl able to send a http message over UDP?

like image 584
MOHAMED Avatar asked Oct 19 '25 03:10

MOHAMED


2 Answers

No it doesn't. For HTTP, libcurl only supports TCP or Unix domain socket. It could possibly be something to add in a future.

(libcurl supports UDP transfers for a few other protocols.)

HTTP/3

HTTP/3 is done over QUIC which is done over UDP, so strictly speaking if you use curl to do a HTTP/3 transfer it will use UDP. But I'm just guessing that is not what this question is about...

like image 58
Daniel Stenberg Avatar answered Oct 21 '25 18:10

Daniel Stenberg


HTTP could in theory be used over a different protocol than TCP (this case is mentioned in RFC2616), but it needs to be a reliable protocol, that is a protocol which provides guaranteed delivery, must keep the order of messages and must detect duplicates. Plain UDP does not provide these things and thus it is not possible to use HTTP over plain UDP and thus libcurl does not provide it.

If you are interested in a protocol with a syntax close to HTTP, but with support of UDP, then have a look at SIP which is used for VoIP.

like image 41
Steffen Ullrich Avatar answered Oct 21 '25 18:10

Steffen Ullrich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!