Re: Not reading, or sending, fast enough on my serial application




af300wsm@xxxxxxxxx wrote:
but now I'm seeing that my application drops packets.

Now, I'm trying isolate where I'm having difficulty. The code places
the serial driver in raw, non-canonical, mode for all the read and
write calls. So I have two questions.

Pertinent information: packet size is 255 bytes.

1) on the send, or write, side of the app. I simply open the serial
line and write the 2500 packets to it. This part of the application
takes, approx., 5 seconds to complete. I'm wondering, since the serial
line is set to 115200 BAUD, am I'm writing the data to the device
faster than the kernel can send it and therefore bits are being dropped
in the buffer before being sent?

This is always true -- your write sends data instantaneously. The port
buffers the data and sends it to the uart. So, the answer to this
question is NO.

2) on the receive, read, side; I again place the serial line in raw
mode and then set the c_cc[VMIN] member to the packet size and then set
the c_cc[VTIME] member to 0. I also call fcntl to set the FNDELAY flag
on the descriptor and then use select() with a timeout of 30 seconds on
the file descriptor (the extremely long timeout is only to allow the
user to start the sender on another computer before the timeout). What
I'm wondering is, am I incorrectly using these facilities? Since I'm
setting VMIN to 255, is select extraneous? Also, since I'm setting
VMIN to 255 AND I'm setting the flags to FNDELAY, is the read still
being blocked until the 255 characters are present?

Can't answer this one -- I never use select on a serial port. Why you
use the FNDELAY open flag and set VMIN to 255??? Do you want to wait
for 255 characters, or not?

karl m

.



Relevant Pages

  • Re: Serialport termios & timeout
    ... for VTIME and VMIN I can do it, ... If VTIME and VMIN are both greater than 0 the timer is ... and will timeout if there is the ...
    (comp.os.linux.development.apps)
  • Re: Peeking in to the serial buffer
    ... > think) flag, and provide a timeout value as one of the parameters. ... Setup up the serial port and flush the buffer to remove any ... Have a QIO (not QIOW) that completes when there are two bytes in the ...
    (comp.os.vms)
  • Re: Best way to share data between threads
    ... > instrument that needs firmware ftp'ed to it after a cold start, ... I usually get around this by polling on a thread flag until its ... state changes as expected or a timeout occurs. ...
    (freebsd-questions)
  • Re: A better interface, perhaps: a timed signal flag
    ... the kernel would setup a flag for you and then map it into userspace. ... and limiting this facility to one such timeout per ...
    (Linux-Kernel)
  • exchange 5.5 delivery timeout
    ... I've seemed to look everywhere for the flag to increase the SMTP delivery ... timeout but I cant find it in the admin console. ... I might have to go into the registry and change this flag would anyone know ... Or am I missing something in admin console? ...
    (microsoft.public.exchange.admin)