예제 #1
0
func (soc *Socket) setUInt64(opt C.int, value uint64) error {
	val := C.uint64_t(value)
	if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 {
		return errget(err)
	}
	return nil
}
예제 #2
0
파일: zmq.go 프로젝트: miffa/gozero
func (p lzmqSocket) SetStringSockOpt(option int, value string) os.Error {
	cstring := (unsafe.Pointer)(C.CString(value))
	defer C.free(cstring)

	// TODO CheckMem
	return p.Provider().OkIf(C.zmq_setsockopt(unsafe.Pointer(p), C.int(option), cstring, C.size_t(len(value))) == 0)
}
예제 #3
0
파일: zmq.go 프로젝트: gopherds/gophernotes
// Set an int option on the socket.
// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (s *Socket) SetSockOptInt(option IntSocketOption, value int) error {
	val := C.int(value)
	if rc, err := C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); rc != 0 {
		return casterr(err)
	}
	return nil
}
예제 #4
0
func (soc *Socket) setString(opt C.int, s string) error {
	cs := C.CString(s)
	defer C.free(unsafe.Pointer(cs))
	if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(cs), C.size_t(len(s))); i != 0 {
		return errget(err)
	}
	return nil
}
예제 #5
0
파일: zmq.go 프로젝트: quenel/gozmq
// Set a string option on the socket.
// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (s *Socket) SetSockOptString(option StringSocketOption, value string) error {
	v := C.CString(value)
	defer C.free(unsafe.Pointer(v))
	if rc, err := C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(v), C.size_t(len(value))); rc != 0 {
		return casterr(err)
	}
	return nil
}
예제 #6
0
파일: zmq.go 프로젝트: psilva261/gozmq
// Set a string option on the socket.
// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (s *zmqSocket) SetSockOptString(option StringSocketOption, value string) error {
	v := C.CString(value)
	defer C.free(unsafe.Pointer(v))
	if C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(v), C.size_t(len(value))) != 0 {
		return errno()
	}
	return nil
}
예제 #7
0
func (s *Socket) APubApprove(value string, peerid uint32) error {
	v := C.CString(value)
	defer C.free(unsafe.Pointer(v))
	if rc, err := C.zmq_setsockopt(s.s, C.int(APUB_APPROVE), unsafe.Pointer(v), C.size_t(peerid)); rc != 0 {
		return casterr(err)
	}
	return nil
}
예제 #8
0
func (soc *Socket) setNullString(opt C.int) error {
	if !soc.opened {
		return ErrorSocketClosed
	}
	if i, err := C.zmq_setsockopt(soc.soc, opt, nil, 0); i != 0 {
		return errget(err)
	}
	return nil
}
예제 #9
0
func (soc *Socket) setInt64(opt C.int, value int64) error {
	if !soc.opened {
		return ErrorSocketClosed
	}
	val := C.int64_t(value)
	if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 {
		return errget(err)
	}
	return nil
}
예제 #10
0
파일: zmq.go 프로젝트: badgerodon/zmq
// SetSocketOption
func SetSocketOptionString(socket ZSocket, option_name int, option_value string) os.Error {
	bs := []byte(option_value)
	n := C.int(option_name)
	sz := C.size_t(len(option_value))
	var addr unsafe.Pointer
	if len(bs) > 0 {
		addr = unsafe.Pointer(&bs[0])
	}
	return handle(C.zmq_setsockopt(socket.Ptr, n, addr, sz))
}
예제 #11
0
파일: zmq.go 프로젝트: quenel/gozmq
// Set a string option on the socket to nil.
// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (s *Socket) SetSockOptStringNil(option StringSocketOption) error {
	if rc, err := C.zmq_setsockopt(s.s, C.int(option), nil, 0); rc != 0 {
		return casterr(err)
	}
	return nil
}
예제 #12
0
파일: zmq.go 프로젝트: quenel/gozmq
// Set a uint64 option on the socket.
// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (s *Socket) SetSockOptUInt64(option UInt64SocketOption, value uint64) error {
	if rc, err := C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(&value), C.size_t(unsafe.Sizeof(value))); rc != 0 {
		return casterr(err)
	}
	return nil
}
예제 #13
0
파일: zmq.go 프로젝트: psilva261/gozmq
// Set a uint64 option on the socket.
// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (s *zmqSocket) SetSockOptUInt64(option UInt64SocketOption, value uint64) error {
	if C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(&value), C.size_t(unsafe.Sizeof(value))) != 0 {
		return errno()
	}
	return nil
}
예제 #14
0
파일: zmq.go 프로젝트: miffa/gozero
func (p lzmqSocket) SetBinaryDataSockOpt(option int, value []byte) os.Error {
	// TODO CheckMem
	return p.Provider().OkIf(C.zmq_setsockopt(unsafe.Pointer(p), C.int(option), unsafe.Pointer(&value[0]), C.size_t(len(value))) == 0)
}
예제 #15
0
파일: zmq.go 프로젝트: miffa/gozero
func (p lzmqSocket) SetUInt64SockOpt(option int, value uint64) os.Error {
	// TODO CheckMem
	return p.Provider().OkIf(C.zmq_setsockopt(unsafe.Pointer(p), C.int(option), unsafe.Pointer(&value), C.size_t(unsafe.Sizeof(value))) == 0)
}
예제 #16
0
func (s *Socket) DisconnectPeerById(id uint32) error {
	if rc, err := C.zmq_setsockopt(s.s, C.int(DISCONNECT_PEER_BY_ID), unsafe.Pointer(nil), C.size_t(id)); rc != 0 {
		return casterr(err)
	}
	return nil
}