main.go raw

   1  package main
   2  
   3  import (
   4  	"fmt"
   5  	"time"
   6  	
   7  	"github.com/p9c/p9/pkg/qu"
   8  	
   9  	"github.com/p9c/p9/pkg/pipe"
  10  )
  11  
  12  func main() {
  13  	p := pipe.Serve(qu.T(), func(b []byte) (e error) {
  14  		fmt.Print("from parent: ", string(b))
  15  		return
  16  	},
  17  	)
  18  	for {
  19  		_, e := p.Write([]byte("ping"))
  20  		if e != nil {
  21  			fmt.Println("err:", e)
  22  		}
  23  		time.Sleep(time.Second)
  24  	}
  25  }
  26