Example #1
0
File: zmq.go Project: quenel/gozmq
// Bind the socket to a listening address.
// int zmq_bind (void *s, const char *addr);
func (s *Socket) Bind(address string) error {
	a := C.CString(address)
	defer C.free(unsafe.Pointer(a))
	if rc, err := C.zmq_bind(s.s, a); rc != 0 {
		return casterr(err)
	}
	return nil
}
Example #2
0
// Bind the socket to a listening address.
// int zmq_bind (void *s, const char *addr);
func (s *zmqSocket) Bind(address string) error {
	a := C.CString(address)
	defer C.free(unsafe.Pointer(a))
	if C.zmq_bind(s.s, a) != 0 {
		return errno()
	}
	return nil
}
Example #3
0
/*
Accept incoming connections on a socket.

For a description of endpoint, see: http://api.zeromq.org/3-2:zmq-bind#toc2
*/
func (soc *Socket) Bind(endpoint string) error {
	s := C.CString(endpoint)
	defer C.free(unsafe.Pointer(s))
	if i, err := C.zmq_bind(soc.soc, s); int(i) != 0 {
		return errget(err)
	}
	return nil
}
Example #4
0
// Binds the socket to the specified local endpoint address.
func (s *Socket) Bind(endpoint string) (err error) {
	cstr := C.CString(endpoint)
	defer C.free(unsafe.Pointer(cstr))
	r := C.zmq_bind(s.sock, cstr)
	if r == -1 {
		err = zmqerr()
	}
	return
}
Example #5
0
func Bind(socket ZSocket, endpoint string) os.Error {
	return handle(C.zmq_bind(socket.Ptr, C.CString(endpoint)))
}
Example #6
0
File: zmq.go Project: miffa/gozero
// Bind server socket
func (p lzmqSocket) Bind(address string) os.Error {
	ptr := unsafe.Pointer(p)
	// apparantly freed by zmq
	c_addr := C.CString(address)
	return p.Provider().OkIf(C.zmq_bind(ptr, c_addr) == 0)
}