Linux pipes

Tasos Laskos tasos.laskos at gmail.com
Wed Sep 24 13:54:08 EEST 2008


Giorgos Keramidas wrote:
> On Wed, 24 Sep 2008 12:53:29 +0300, Tasos Laskos <tasos.laskos at gmail.com> wrote:
>> Christos Ricudis wrote:
>>> 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.
>> Eyxaristo poly, ayto ksedialine kapos ta pragmata.
>> 8a prepei na paikso me to kodika prin to ensomatoso sto vget giati
>> omologo pos eimai ligo mperdemenos.
>
>> To poly poly an de katafero na kano ayto pou 8elo 8a valo ena apo ta
>> ergaleia apo to freashmeat os dependency kai 8a xrisimopoieio ayto
>> anamesa sto vget kai ton ekastote player.
>
> Εναλλακτικά, μπορείς να χρησιμοποιήσεις το universal buffering tool που
> έχουν όλα τα UNIX: το dd(1).
>
>         vget [options] PATH | dd ibs=10m obs=4k | lalaki
>
> Ετσι το vget θα μπορεί να γράφει σε batches από 10 MB στο output του,
> και το dd θα ταίζει το lalaki με 4 KB chunks.
>
> Το freshmeat έχει ενδιαφέροντα πράγματα, αλλά στη συγκεκριμένη περίπτωση
> μάλλον δε χρειάζεται.
>
Nai ontos, ayto akrivos i8ela na kano, eyxaristo. :)
Mallon, mazi me to vget 8a deino kai ena wrapper/driver shell script pou 
8a analamvanei to komati tou streaming.
Mou pernaei kai to system() apo to myalo vevaia alla 8a itan too dirty 
nomizo...
>> [1] Toses "pipes" stis 10:31am einai kapos.... kapos. Mallon kapoios
>> ksypnise me kefakia simera :P
>
> Μην τον ρωτήσεις _πως_ _ακριβώς_ ή _γιατί_ ξύπνησε όμως, γιατί μπορεί να
> είναι too much info!
>

Hahahaha, oxi de to eixa skopo.
Mou ftanei i voi8eia gia to vget, to ypolipo info 8a itan ontos too much. :P




More information about the Linux-greek-users mailing list