Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,
I am developing a multi socket application in BREW 2.1.3. I have opened two+ sockets in it. Both have own Read CB functions. Due to lengthy operations on socket data including UI update, I may get a read callback for 'other' sockets. But I want to defer reading before my current process on data from earlier socket is complete. Also I dont want to loose data on 'other' sockets.

1. Can I defer reading from sockets in this case?
2. Will BREW again call socket CB function?

Thanks
Sam

BREW won't call your socket callback again, unless you call ISOCKET_Readable. And if you do that, and data is available, you'll get an immediate callback. The readable callback says data is available to be read. You don't have to read it..
So having been notified, if you want to delay processing, as you are not yet ready to handle the data, your easiest approach is to use ISHELL_SetTimer. You can pass in the same PFNNOTIFY that you used for ISOCKET_Readable.
Either
a) Set an actual delay, get called back, and maybe have to reschedule. You risk increasing your latency though.
or
b) Cal ISHELL_SetTimer(shell, 0, pfnNotify) when you know you're ready to process the data

BREW won't call your socket callback again, unless you call ISOCKET_Readable. And if you do that, and data is available, you'll get an immediate callback. The readable callback says data is available to be read. You don't have to read it..
So having been notified, if you want to delay processing, as you are not yet ready to handle the data, your easiest approach is to use ISHELL_SetTimer. You can pass in the same PFNNOTIFY that you used for ISOCKET_Readable.
Either
a) Set an actual delay, get called back, and maybe have to reschedule. You risk increasing your latency though.
or
b) Cal ISHELL_SetTimer(shell, 0, pfnNotify) when you know you're ready to process the data