// Open creates a connection to QMP at the specified address using the named protocol
// Protocol can be tcp or unix
Open creates a connection to QMP at the specified address using the named protocol
Protocol can be tcp or unix
// Open creates a connection to QMP at the specified address using the named protocol // Protocol can be tcp or unix
func Open(proto, addr string) (Session, error) {
	var s Session
	c, err := net.Dial(proto, addr)
	if err != nil {
		return s, err
	}
	s.c = c
	var g GreetingMessage
	err = json.NewDecoder(c).Decode(&g)
	if err != nil {
		return s, fmt.Errorf("qmp: decode json greeting: %s", err)
	}
	s.Greeting = g
	_, err = s.Command("qmp_capabilities", nil)
	if err != nil {
		return s, err
	}
	return s, nil
}
func Open ( proto , addr string ) ( Session , error ) { var s Session c , err := net . Dial ( proto , addr ) if err != nil { return s , err } s . c = c var g GreetingMessage err = json . NewDecoder ( c ) . Decode ( & g ) if err != nil { return s , fmt . Errorf ( " " , err ) } s . Greeting = g _ , err = s . Command ( " " , nil ) if err != nil { return s , err } return s , nil }
Open creates a connection to QMP at the specified address using the named protocol
Protocol can be tcp or unix
Open creates a connection to QMP at the specified address using the named protocol Protocol can be tcp or unix