Linux pipes
Giorgos Keramidas
keramida at ceid.upatras.gr
Wed Sep 24 13:31:39 EEST 2008
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 έχει ενδιαφέροντα πράγματα, αλλά στη συγκεκριμένη περίπτωση
μάλλον δε χρειάζεται.
> [1] Toses "pipes" stis 10:31am einai kapos.... kapos. Mallon kapoios
> ksypnise me kefakia simera :P
Μην τον ρωτήσεις _πως_ _ακριβώς_ ή _γιατί_ ξύπνησε όμως, γιατί μπορεί να
είναι too much info!
More information about the Linux-greek-users
mailing list