Re: using curl for streaming rtsp/rtp over tcp

2021-06-20 Thread jeremy--- via curl-library
On Sun, 20 Jun 2021, at 15:14, Abhijeet Bhagat via curl-library wrote:

> i am using libcurl to send rtsp commands (over tcp) to a server.
I did a very similar exercise quite a few years ago (but am a bit rusty on the 
subject)

> i was expecting CURLOPT_WRITEFUNCTION to get repeatedly called with the 
> packet but that isn't happening.
After sending the CURL_RTSPREQ_PLAY, try adding something like

curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_RECEIVE);
curl_easy_perform(curl);---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

curl_easy_perform blocks when ifdown the ntwk interface

2018-11-09 Thread Matthews, Jeremy via curl-library
Hi,

I have some C++ code which sends REST requests periodically. Here are some 
options that are set and then the curl_easy_perform call (a HEAD message is 
being sent):

curl_easy_setopt(mhCurl, CURLOPT_HTTPHEADER, chunk);
curl_easy_setopt(mhCurl, CURLOPT_URL, f_szUrl.c_str());
curl_easy_setopt(mhCurl, CURLOPT_CONNECTTIMEOUT, f_lTimeoutSec);
curl_easy_setopt(mhCurl, CURLOPT_CUSTOMREQUEST, NULL);
curl_easy_setopt(mhCurl, CURLOPT_NOBODY, 1L);
curl_easy_setopt(mhCurl, CURLOPT_POST, 0L);
curl_easy_setopt(mhCurl, CURLOPT_UPLOAD, 0L);
curl_easy_setopt(mhCurl, CURLOPT_HEADERDATA, (void *)&rsp);
ret = curl_easy_perform(mhCurl);

This is in executable running in Linux. At the Linux command line, if I do an 
ifdown on the network interface upon which the message is sent, then 
curl_easy_perform blocks and does not return.

The CURLOPT_CONNECTTIMEOUT value is 3 seconds, but that doesn't appear to be 
having an effect.

How do I get curl_easy_perform to return if the network interface is down? Is 
there an option to do this?

I noticed that there is a curl_multi_perform that doesn't block, but I'm hoping 
to not go that route, because that would require a different handle type that 
is used in multiple places in the code.

Should the interface somehow be checked before calling curl_easy_perform?

Thanks in advance for any thoughts!

Jeremy


---
Notice: This e-mail together with any attachments may contain information of 
Ribbon Communications Inc. that
is confidential and/or proprietary for the sole use of the intended recipient.  
Any review, disclosure, reliance or
distribution by others or forwarding without express permission is strictly 
prohibited.  If you are not the intended
recipient, please notify the sender immediately and then delete all copies, 
including any attachments.
---
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

RE: curl_easy_perform blocks when ifdown the ntwk interface

2018-11-13 Thread Matthews, Jeremy via curl-library
Thank you for your input.

Well, curl_easy_perform did appear to block. When the interface was down, the 
function did not return, let alone return an error code.

I have made this change:

< curl_easy_setopt(mhCurl, CURLOPT_CONNECTTIMEOUT, f_lTimeoutSec);
---
> curl_easy_setopt(mhCurl, CURLOPT_TIMEOUT, f_lTimeoutSec);

...and curl_easy_perform now returns and with the expected return code of 45 
(CURLE_INTERFACE_FAILED).

Could there be an issue here with curl_easy_perform (and the earlier option) if 
the interface is down?

I usually do not fiddle with ifdown and ifup. I was just trying to simulate a 
network issue.

Thanks,

Jeremy

From: curl-library  On Behalf Of 
curl-library-requ...@cool.haxx.se
Sent: Tuesday, November 13, 2018 5:00 AM
To: curl-library@cool.haxx.se
Subject: curl-library Digest, Vol 159, Issue 11


NOTICE: This email was received from an EXTERNAL sender


Send curl-library mailing list submissions to
curl-library@cool.haxx.se

To subscribe or unsubscribe via the World Wide Web, visit
https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library
or, via email, send a message with subject or body 'help' to
curl-library-requ...@cool.haxx.se

You can reach the person managing the list at
curl-library-ow...@cool.haxx.se

When replying, please edit your Subject line so it is more specific
than "Re: Contents of curl-library digest..."


Today's Topics:

1. Re: curl_easy_perform blocks when ifdown the ntwk interface
(doa379)


--

Message: 1
Date: Mon, 12 Nov 2018 13:03:23 +
From: doa379 mailto:doa...@gmail.com>>
To: curl-library@cool.haxx.se
Subject: Re: curl_easy_perform blocks when ifdown the ntwk interface
Message-ID: 
<8db8f502-c31f-9871-a153-27934a5c1...@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed

> I have some C++ code which sends REST requests periodically. Here are some 
> options that are set and then the curl_easy_perform call (a HEAD message is 
> being sent):
>
> curl_easy_setopt(mhCurl, CURLOPT_HTTPHEADER, chunk);
> curl_easy_setopt(mhCurl, CURLOPT_URL, f_szUrl.c_str());
> curl_easy_setopt(mhCurl, CURLOPT_CONNECTTIMEOUT, f_lTimeoutSec);
> curl_easy_setopt(mhCurl, CURLOPT_CUSTOMREQUEST, NULL);
> curl_easy_setopt(mhCurl, CURLOPT_NOBODY, 1L);
> curl_easy_setopt(mhCurl, CURLOPT_POST, 0L);
> curl_easy_setopt(mhCurl, CURLOPT_UPLOAD, 0L);
> curl_easy_setopt(mhCurl, CURLOPT_HEADERDATA, (void *)&rsp);
> ret = curl_easy_perform(mhCurl);
>
> This is in executable running in Linux. At the Linux command line, if I do an 
> ifdown on the network interface upon which the message is sent, then 
> curl_easy_perform blocks and does not return.
>
> The CURLOPT_CONNECTTIMEOUT value is 3 seconds, but that doesn't appear to be 
> having an effect.
>
> How do I get curl_easy_perform to return if the network interface is down? Is 
> there an option to do this?
>
> I noticed that there is a curl_multi_perform that doesn't block, but I'm 
> hoping to not go that route, because that would require a different handle 
> type that is used in multiple places in the code.
>
> Should the interface somehow be checked before calling curl_easy_perform?
>


If the network is down, curl_easy_perform sends a return code. These are
the timeout settings I regularly use:

const long dl_lowspeed_bytes = 1000; /* 1K */
const long dl_lowspeed_time = 10; /* sec */
/* bytes/sec */
curl_easy_setopt(, CURLOPT_LOW_SPEED_LIMIT, dl_lowspeed_bytes);
/* seconds while below low speed limit before aborting */
curl_easy_setopt(, CURLOPT_LOW_SPEED_TIME, dl_lowspeed_time);

There is no reason to fiddle with the Debian tools ifdown or ifup. Info:
ifdown only works on the network interface and not the network connection.

Second, the curl multi handle is useful if you're doing a batch transfer
(many connections in one go). You can still use it but it's not
necessary for simple or one off transfers, or unless in scenarios where
you have to care about rate limitation.


--

Subject: Digest Footer

___
curl-library mailing list
curl-library@cool.haxx.se
https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library


--

End of curl-library Digest, Vol 159, Issue 11
*


---
Notice: This e-mail together with any attachments may contain information of 
Ribbon Communications Inc.