at the beginning of recvEventTimed() there is the line:
if (!ms) {
return esl_recv_event(handle, check_q, save_event);
}

so if you send ms=0, then it's exactly the same as esl_recv_event()

If you're already using esl, then you might as well look at the esl code, it's written in plain c and a lot of it is quite easy to understand at first glance


On Mon, May 26, 2014 at 10:40 AM, Grant Bagdasarian <GB@cm.nl> wrote:

Hello,

 

Their behavior is different, but both are used to receive events.

 

recvEvent blocks until Freeswich sends it an Event.

recvEventTimed(1000) waits for 1 second max to receive an event from FS. If no event is received within 1 second, the program will continue to execute the next line of code.

 

I use both variants for different scenarios.

 

From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Antonio
Sent: Saturday, May 24, 2014 1:52 PM
To: freeswitch-users@lists.freeswitch.org
Subject: [Freeswitch-users] ESL: recvEvent vs recvEventTimed

 

Hi all,

I'm doing a esl program to get all the events from fs and I always want to wait for an event before continue.

but i facing a difficult decision to choose between recvEvent() or recvEventTimed(0).

I read in the wiki:
recvEvent() - blocks until it receives an event
recvEventTimed(0) - waits X ms  or blocks until it receives an event

so they are the same or no?
For your experience with ESL what method do you recommend?

Thanks,
António


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org