func (c *Connector) Connect(url string) error { cUrl := C.CString(url) defer C.free(unsafe.Pointer(cUrl)) r := C.xmmsc_connect(c.connection, cUrl) if r == 0 { return fmt.Errorf("Connection failed %v", c.GetLastError()) } return nil }
/* Connect to xmms server, both tcp or unix socket are works. x = NewXmms2Client("test") x.Connect("unix://somewhere") x.Connect("tcp://somewhere") */ func (x *Xmms2Client) Connect(url string) error { cUrl := C.CString(url) defer C.free(unsafe.Pointer(cUrl)) r := C.xmmsc_connect(x.connection, cUrl) if r == 0 { errInfo := C.GoString(C.xmmsc_get_last_error(x.connection)) return errors.New(fmt.Sprintf("Connection failed: %s", errInfo)) } return nil }