本文整理匯總了Golang中C.zmq_setsockopt函數的典型用法代碼示例。如果您正苦於以下問題:Golang zmq_setsockopt函數的具體用法?Golang zmq_setsockopt怎麽用?Golang zmq_setsockopt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了zmq_setsockopt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setUInt64
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: SetStringSockOpt
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: SetSockOptInt
// 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: setString
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: SetSockOptString
// 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: SetSockOptString
// 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: APubApprove
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: setNullString
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: setInt64
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: SetSocketOptionString
// 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: SetSockOptStringNil
// 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: SetSockOptUInt64
// 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: SetSockOptUInt64
// 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: SetBinaryDataSockOpt
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: SetUInt64SockOpt
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)
}