Ejemplo n.º 1
0
func main() {
	log.SetFlags(log.Lshortfile)

	c, err := fdrpc.Dial("/tmp/test.socket")
	if err != nil {
		log.Fatal(err)
	}

	var fd fdrpc.FD
	if err := c.Call("Obj.GetStdOut", struct{}{}, &fd); err != nil {
		log.Fatal(err)
	}
	syscall.Write(fd.FD, []byte("Hello from request 1\n"))

	if err := c.Call("Obj.GetStdOut", struct{}{}, &fd); err != nil {
		log.Fatal(err)
	}
	syscall.Write(fd.FD, []byte("Hello from request 2\n"))

	var streams []fdrpc.FD
	if err := c.Call("Obj.GetStreams", struct{}{}, &streams); err != nil {
		log.Fatal(err)
	}
	syscall.Write(streams[0].FD, []byte("Hello stdout\n"))
	syscall.Write(streams[1].FD, []byte("Hello stderr\n"))
}
Ejemplo n.º 2
0
func NewClient(path string) (*Client, error) {
	c, err := fdrpc.Dial(path)
	return &Client{c}, err
}