Linux pipes

Christos Ricudis ricudis at itc.auth.gr
Wed Sep 24 10:31:20 EEST 2008


Tasos Laskos wrote:
> Kalispera sti lista,
>
> Exo mia aporia/provlima me linux pipes.
> Exo grapsei ena programma to opoio katevazei video kai to stelnei sto 
> stdin tou Kaffeine player.
>
> Px:
> ----------------
> vget --stdout http://www.veoh.com/videos/v6272417ktA6zTWy | kaffeine 
> stdin://
> ----------------
>
> Exo paratirisei omos pos otan patao pause sto Kaffeine to programma 
> kanei episis pause.
> Stamataei akoma kai na katevazei to video, vlepo apo network monitor 
> pos i taxitita peftei sto 0kBps. 

Opws mporeis poly eykola na fantasteis, o xwros proswrinhs apo8hkeyshs 
sthn pipa einai periorismenos (kai stis perissoteres periptwseis 
proka8orismenos), ara o dinwn thn pipa 8a prepei na stamathsei thn 
paragwgh mexri h lambanousa thn pipa process na mporesei na katapiei ta 
dedomena.

Ayth h symperifora mporei na allaksei mono ean kaneis dikh sou endiamesh 
apo8hkeysh twn dedomenwn se kapoio buffer - bebaia gi ayto 8a prepei na 
grapseis kwdika, kai ta details einai ligo pipa. H logikh panw katw 
einai h ekshs :

declare buffer[MAXLEN]

while (not eof())  {
    if (write end of pipe is blocking) then {
       if (read end of pipe is not blocking and buffer is not full) {
          read data into buffer
       } else {
          block read end of pipe
       }
   
    if (write end of pipe is not blocking) then {
       if (buffer is not empty) {
           feed data from buffer into write end of pipe  
       } else {
          block write end of pipe
       }
    }
}

To kalo m'ayth thn me8odo einai oti mporeis na pros8eseis meta polla 
diakosmhtika features apo ayta poy kanoyn thn pipa apolaysh, opws 
bandwitdh meter, bandwidth throttling, variable size buffering me jitter 
detection, ktl ktl ktl.

An psakseis sto freshmeat gia "pipe", 8a breis kai merika ergaleia poy 
kanoun ayth th douleia.




More information about the Linux-greek-users mailing list