Get rid of this:
Code:
		/* fill buffer with Xs */
	for (ix=0; ix<BUFLEN; ix++) buffer[ix] = 'X';
Change this:
Code:
char buffer[BUFLEN] = {0};
Zero filling your buffer seems smarter than filling it with Xs, especially since you fill the entire thing, including the last space, and then use it like a string later on.

Also, no where in your code that I can find, is there anything that EVER sets your flag to anything other than zero. It's always zero. So it's always going to say it's timing out. Furthermore, if you have defined event states, and you're checking event states, why do you keep switching between using those flags and not using them?
Code:
if( e_flag == 0 )
You should be keeping consistent and always using:
Code:
if( e_flag == EVENT_INPROGRESS )
Or whatever your event is called. Half the time you just use a number, the other half you use your macro.

That combine with you using globals compared to locals, makes reading your code much more difficult.

Quzah.