예제 #1
0
파일: zmq.go 프로젝트: psilva261/gozmq
// Connect the socket to an address.
// int zmq_connect (void *s, const char *addr);
func (s *zmqSocket) Connect(address string) error {
	a := C.CString(address)
	defer C.free(unsafe.Pointer(a))
	if C.zmq_connect(s.s, a) != 0 {
		return errno()
	}
	return nil
}
예제 #2
0
/*
Create outgoing connection from socket.

For a description of endpoint, see: http://api.zeromq.org/3-2:zmq-connect#toc2
*/
func (soc *Socket) Connect(endpoint string) error {
	s := C.CString(endpoint)
	defer C.free(unsafe.Pointer(s))
	if i, err := C.zmq_connect(soc.soc, s); int(i) != 0 {
		return errget(err)
	}
	return nil
}
예제 #3
0
파일: zmq.go 프로젝트: hlife/gozmq
// Connect the socket to an address.
// int zmq_connect (void *s, const char *addr);
func (s *zmqSocket) Connect(address string) error {
	a := C.CString(address)
	defer C.free(unsafe.Pointer(a))
	if rc, err := C.zmq_connect(s.s, a); rc != 0 {
		return casterr(err)
	}
	return nil
}
예제 #4
0
파일: zmq.go 프로젝트: pakohan/go-zmq
// Connects the socket to the specified remote endpoint.
func (s *Socket) Connect(endpoint string) (err error) {
	cstr := C.CString(endpoint)
	defer C.free(unsafe.Pointer(cstr))
	r := C.zmq_connect(s.sock, cstr)
	if r == -1 {
		err = zmqerr()
	}
	return
}
예제 #5
0
파일: zmq.go 프로젝트: badgerodon/zmq
func Connect(socket ZSocket, endpoint string) os.Error {
	return handle(C.zmq_connect(socket.Ptr, C.CString(endpoint)))
}
예제 #6
0
파일: zmq.go 프로젝트: miffa/gozero
// Connect client socket
func (p lzmqSocket) Connect(address string) os.Error {
	ptr := unsafe.Pointer(p)
	// apparently freed by zmq
	c_addr := C.CString(address)
	return p.Provider().OkIf(C.zmq_connect(ptr, c_addr) == 0)
}