當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.zmq_setsockopt函數代碼示例

本文整理匯總了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
}
開發者ID:Dragomir-Ivanov,項目名稱:zmq3,代碼行數:7,代碼來源:socketset.go

示例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)
}
開發者ID:miffa,項目名稱:gozero,代碼行數:7,代碼來源:zmq.go

示例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
}
開發者ID:gopherds,項目名稱:gophernotes,代碼行數:9,代碼來源:zmq.go

示例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
}
開發者ID:Dragomir-Ivanov,項目名稱:zmq3,代碼行數:8,代碼來源:socketset.go

示例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
}
開發者ID:quenel,項目名稱:gozmq,代碼行數:10,代碼來源:zmq.go

示例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
}
開發者ID:psilva261,項目名稱:gozmq,代碼行數:10,代碼來源:zmq.go

示例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
}
開發者ID:unkstar,項目名稱:gozmq,代碼行數:8,代碼來源:zmq_3_x_hack.go

示例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
}
開發者ID:jimenezrick,項目名稱:zmq4,代碼行數:9,代碼來源:socketset.go

示例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
}
開發者ID:jimenezrick,項目名稱:zmq4,代碼行數:10,代碼來源:socketset.go

示例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))
}
開發者ID:badgerodon,項目名稱:zmq,代碼行數:11,代碼來源:zmq.go

示例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
}
開發者ID:quenel,項目名稱:gozmq,代碼行數:8,代碼來源:zmq.go

示例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
}
開發者ID:quenel,項目名稱:gozmq,代碼行數:8,代碼來源:zmq.go

示例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
}
開發者ID:psilva261,項目名稱:gozmq,代碼行數:8,代碼來源:zmq.go

示例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)
}
開發者ID:miffa,項目名稱:gozero,代碼行數:4,代碼來源:zmq.go

示例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)
}
開發者ID:miffa,項目名稱:gozero,代碼行數:4,代碼來源:zmq.go


注:本文中的C.zmq_setsockopt函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。