Determine how much can I write into a filehandle
        Posted  
        
            by Vi
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Vi
        
        
        
        Published on 2010-04-20T09:37:04Z
        Indexed on 
            2010/04/20
            9:43 UTC
        
        
        Read the original article
        Hit count: 1848
        
How to determine if I can write the given number of bytes to a filehandle (socket actually)? (Alternatively, how to "unread" the data I had read from other filehandle?)
I want something like:
n = how_much_can_I_write(w_handle); n = read(r_handle, buf, n); assert(n==write(w_handle, buf, n));
Both filehandles (r_handle and w_handle) have received ready status from epoll_wait.
I want all data from r_handle to be copied to w_handle without using a "write debt" buffer.
© Stack Overflow or respective owner