Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9926

Re: How to get number of bytes written to nonblocking FIFO when EAGAIN is raised?

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: How to get number of bytes written to nonblocking FIFO when EAGAIN is raised?
Date 2011-07-19 22:26 -0400
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-FE4E60.22263919072011@news.panix.com> (permalink)
References <40996f2a-4ed8-4388-ae1a-6f81f57a4526@f17g2000prf.googlegroups.com>

Show all headers | View raw


In article 
<40996f2a-4ed8-4388-ae1a-6f81f57a4526@f17g2000prf.googlegroups.com>,
 Aaron Staley <usaar33@gmail.com> wrote:

> Scenario. I have a fifo named 'fifo' on my computer (ubuntu linux)
> operating in nonblocking mode for both read and write.  Under normal
> operation all is good:
> 
> Interpreter 1 (writer)
> >>> import os
> >>> fd = os.open('fifo', os.O_WRONLY | os.O_NONBLOCK)
> >>> f = os.fdopen(fd,'wb')
> [...]
> Unfortunately, the IOError seems to have no attribute indicating how
> much data was successfully sent.  I've looked through the docs and
> can't seem to figure out how; can anyone land some advice?

I'm thinking you want to skip the os.fdopen() call and use the file 
descriptor directly, with os.write().  I've never used this, but it 
seems like what you probably want to try.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to get number of bytes written to nonblocking FIFO when EAGAIN is raised? Aaron Staley <usaar33@gmail.com> - 2011-07-19 18:19 -0700
  Re: How to get number of bytes written to nonblocking FIFO when EAGAIN is raised? Roy Smith <roy@panix.com> - 2011-07-19 22:26 -0400
  Re: How to get number of bytes written to nonblocking FIFO when EAGAIN is raised? Adam Skutt <askutt@gmail.com> - 2011-07-19 20:15 -0700
    Re: How to get number of bytes written to nonblocking FIFO when EAGAIN is raised? Aaron Staley <usaar33@gmail.com> - 2011-07-21 00:46 -0700

csiph-web