select() timeout not precise in terminal

I want to read something from UDP. And i write and run the program in Momentics(XP) and it works fine. The select() timeout is precise enough(8ms).
After that, i use fs-cifs and transferd the compiled files to QNX and run it in terminal.And here comes the problem. It runs but not so correctly. The timerout is not so precise now, and is about 15,16ms.
Please help…
Another question, if i want to compile the program i wrote in Momentics with linker option(if i want to use socket API in Momentics, i have to go to preference->linker and add -lsocket), what should i type in terminal to support Socket API, qcc myprogram.c -o m … or something else?


If you are compiling from the command line in QNX you add -lsocket the same as you do in the in the IDE.

I’m not sure why your timeout is working in Momentics + QNX target machine (you clearly can’t be running in XP you have to be running on a target machine) and not when you create an image file system on the target.

My initial guess is it must be something to do with priorities (ie the IDE running at a higher priority than the program is on its own). What else do you have running on the machine in terms of your own programs/threads?

Is the timer always running at 15/16ms or only occasionally that slow?


thank you, Tim.
I do know when i click run in Momentics(XP) it actually runs in QNX(target machines). :wink:
You mean i just type like this:
qcc /root/prog.c -o /root/porg -lsocket

Actually i didn’t create an image(a little complicated for me) and i just want to run it without running IDE in XP. So i compiled it in XP and moved the file(x86/projectname/prog) to QNX and run it in command line.
To solve this problem, i adjust the parameter of timeout. Sometimes it is smaller than 10ms(good for me), but most of the time it turns out to be much much bigger(14,15,16ms).



This sounds like a problem where some other process (yours or an O/S one) or thread (yours) is interfering with the timing. Can you post your code (I assume you are using test code to test with) and tell me what is running on your QNX machine besides the basic standard stuff (ie are you running photon, any other process you created etc).


You might want to try setting a high priority “setprio()” and see if this changes things.