Serial Connection Question

Hi, I have been working on porting code for communicating with a device over
a serial interface to qnx 6. My program usually works fine. However, on
rare occasions, when I write to the fd for the serial connection, my message
isn’t actually transmitted over the serial line for several seconds. I know
this because I call tcdrain (), which causes the process to wait until any
data sent to the specified fd has been transmitted. Does anyone know why
this problem may be occurring and whether there is any way of ensuring that
data sent to a serial device will be transmitted immediately? Please email
me at if you have any ideas.