Problems with MsgReceive

I’m having problems with the function ‘MsgReceive()’. I’ve created a timer which delivers an event when the timer fires. But in the function ‘MsgReceive()’ I get an error, this error is the error number 88, EILSEQ, “Illegal Byte Sequence”. Do you now what does it mean? and, how can avoid it?

The steps I’ve followed in my code is:


while(1) {
if(MsgReceive()<0) {
… what I want to do …

It is certainly weird. It is a shared lib error. Do you use any shared libs?

What version of QNX and what platform(hardware) are you running this on?


Could you post the “exact” code. The pseudo code is allright, but the devil is in the details.

  • Mario

Excuse me for the delayed reply. I’ve been out during thge last two weeks.

The QNX version is 6.1 running in a x86 machine. I don’t use shared libs.
The code of the functions is more detailed here, where Admin() and Control() are launched in “main()”:

---------------------------- Start of code ----------------------------

void Admin() {

int channelSem;
int comSem;
struct sigevent eventSem;
timer_t timerSem;
struct itimerspec timerSem_specs;
struct _pulse timerSem_pulse;
int semVal;

if ((channelSem = ChannelCreate(0)) == -1){

if ((comSem = ConnectAttach(0, 0, channelSem, _NTO_SIDE_CHANNEL, 0)) < 0){

SIGEV_PULSE_INIT(&eventSem, comSem, getprio(0), _PULSE_CODE_MINAVAIL, NULL);

if ((sem_init(&semaforoAdmin, 1, 0)) == -1) {

timer_create(CLOCK_REALTIME, &eventSem, &timerSem);
timerSem_specs.it_value.tv_sec	= 0L;
timerSem_specs.it_value.tv_nsec	= 20*Tns;
timerSem_specs.it_interval.tv_sec	= 0L;
timerSem_specs.it_interval.tv_nsec	= 20*Tns;

if (timer_settime(timerSem, 0, &timerSem_specs, NULL) == -1){

while(1) {
	if(MsgReceive(comSem, &timerSem_pulse, sizeof(struct _pulse), NULL) < 0) {
		printf("Error %d: %s\n", errno, strerror(errno));
	if(timerSem_pulse.code == _PULSE_CODE_MINAVAIL) {
		if(sem_getvalue(&semaforoAdmin,&semVal) == 0) {			
			if ((sem_post(&semaforoAdmin)) == -1) {				
				printf ("No se pudo incrementar el semaforo\a \n");

while(stopCondition == 0) {
	printf("Admin() keep on running ...\n");

printf("Exiting Admin() ...\n\n");


void Control() {

int i;
char tecla;

while(gets(&tecla) == NULL) {  // Manually aborts
	printf("Control() keep on running ...\n");
stopCondition = 1;
printf("Exiting Control() ...\n\n");


----------------------------- end of code ----------------------------------------

Thank you in advance.


Generally the sequence is ChannelCreate(), then MsgReceive(). ConnectAttach() is called by the client which is “sending” to the channel. The code should look like this:

chid = ChannelCreate(…);
MsgReceive(chid, …);

Note that the first parameter of the MsgReceive() call is a CHannelID, not a COnnectionID.

Hope this helps,


Now it works!!.

An stupid error on my own. You were right Rick, I was wrong providing a ConnectionID instead of a ChannelID.

Thanks both.