Flushing UART buffers?

Flushing UART buffers?

Post by Andrew Giert » Sun, 02 Aug 1998 04:00:00

 sgarg> Hi!
 sgarg> I am doing serial programming under Linux/SCO. The system is
 sgarg> communicating with another system and sometimes I get spurious
 sgarg> bytes when I try to read the serial device. What I am looking
 sgarg> for is a way to flush the input buffers of the UART between
 sgarg> two consecutive reads.

 sgarg> I wonder how can one do that.

Look at tcflush()


comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>


1. doing buffered RPC via clnt_call: how to do a buffer flush?


   at the university I am trying to write a fast client/server application
using RPC (tcp mode).
For this I am trying to force RPC to buffer RPC calls which do not need a return
value locally at the client. This should greatly increase the speed of
my application as I do not have to wait for the servers response at every call.

I have figured out to use the buffered clnt_call
   (see RPCs clnt_tcp.c:
      * TCP based RPC supports 'batched calls'.
      * A sequence of calls may be batched-up in a send buffer.  The rpc call
      * return immediately to the client even though the call was not necessaril
      * sent.  The batching occurs if the results' xdr routine is NULL (0) AND
      * the rpc timeout value is zero (see clnt.h, rpc).
This buffers the RPC locally at the client, but seem not send the RPC call
to the server regulary.

My question:

  How do I force RPC to send the buffer contents from the client to the server?
  (how do I flush the buffer).

Any hint is appreciated.

Many thanks.

-- Birgit

2. Opinions on Linux Distributions

3. how to recognize the ^@ char

4. SOLVED: make dep fails (kernel compile)

5. HP JetDirect: Flushing buffer on printer

6. New network configuration

7. How do I flush buffers from a script?

8. Well, flush my buffers!

9. Automatically flushing STDOUT buffer?

10. Forcing a flush of stdout buffer

11. No way to flush rx buffer in serial driver?