thanks for your reply - I had abandoned the approach and used direct register access to send out the data through the serial port to solve the problem of the process hanging.
The reason I need to send out one byte at a time is because the hardware at the receiving end handshake has a time delay. I need to wait about a millisecond after sending each byte to check the handshake signal. otherwise the receiving equipment hangs up. (it is an old CNC controller)