Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > nonblocking write(2) 512K to /dev/ttyS0

Reply
Thread Tools

nonblocking write(2) 512K to /dev/ttyS0

 
 
Bernhard Kuemel
Guest
Posts: n/a
 
      05-30-2010
Hi clc!

Can I write(2) much data (512K) to /dev/ttyS0 on Linux without blocking?
I want to be able to abort/flush the write if the microcontroller which
receives the data reports an error.

At first I planned to write byte wise, but select_tut recommends against
this [1] ... although at 115200 bps this might be acceptable. If I write
byte wise, how long could write() block once the buffer filled up? Until
a character has been transmitted, or is there a hysteresis?

Also I could try to abort/flush the write if a signal handler receives
the error. I would, however, like to keep the program simple, for the
moment.

Thanks, Bernhard

[1]
6. Never read/write only in single bytes at a time unless you
are really sure
that you have a small amount of data to process. It is
extremely inefficient
not to read/write as much data as you can buffer each time.
The buffers in
the example below are 1024 bytes although they could easily
be made larger.
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      05-30-2010
On 5/30/2010 10:08 AM, Bernhard Kuemel wrote:
> Hi clc!
>
> Can I write(2) much data (512K) to /dev/ttyS0 on Linux without blocking?
>[...]


Try comp.unix.programmer or a Linux forum.

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)lid
 
Reply With Quote
 
 
 
 
Bernhard Kuemel
Guest
Posts: n/a
 
      05-30-2010
Eric Sosman wrote:
> On 5/30/2010 10:08 AM, Bernhard Kuemel wrote:
>> Hi clc!
>>
>> Can I write(2) much data (512K) to /dev/ttyS0 on Linux without blocking?
>> [...]

>
> Try comp.unix.programmer or a Linux forum.


Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrades to 3.5m / 512k ASDL? s-t-e-v-e NZ Computing 5 05-14-2006 11:41 AM
Macintosh 512K Uplink Computer Information 0 03-20-2006 04:01 AM
512k connection? Dave - Dave.net.nz NZ Computing 11 03-22-2005 11:06 AM
Telstraclear changing 256k plan to 512k? Stephen Williams NZ Computing 66 03-05-2004 12:17 AM
Seeking 256k or 512k ISP Evil Bastard NZ Computing 0 09-03-2003 02:56 AM



Advertisments