示例#1
0
/*
Disconnect a socket.

For a description of endpoint, see: http://api.zeromq.org/3-2:zmq-connect#toc2
*/
func (soc *Socket) Disconnect(endpoint string) error {
	s := C.CString(endpoint)
	defer C.free(unsafe.Pointer(s))
	if i, err := C.zmq_disconnect(soc.soc, s); int(i) != 0 {
		return errget(err)
	}
	return nil
}
示例#2
0
文件: zmq.go 项目: pakohan/go-zmq
// Disconnects the socket from the specified remote endpoint.
func (s *Socket) Disconnect(endpoint string) (err error) {
	cstr := C.CString(endpoint)
	defer C.free(unsafe.Pointer(cstr))
	r := C.zmq_disconnect(s.sock, cstr)
	if r == -1 {
		err = zmqerr()
	}
	return
}
示例#3
0
// Disconnect the socket from the address.
// int zmq_disconnect (void *s, const char *addr);
func (s *Socket) Disconnect(address string) error {
	if s.c == nil {
		return ENOTSOCK
	}
	a := C.CString(address)
	defer C.free(unsafe.Pointer(a))
	if rc, err := C.zmq_disconnect(s.s, a); rc != 0 {
		return casterr(err)
	}
	return nil
}