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


Golang C.zmq_connect函數代碼示例

本文整理匯總了Golang中C.zmq_connect函數的典型用法代碼示例。如果您正苦於以下問題:Golang zmq_connect函數的具體用法?Golang zmq_connect怎麽用?Golang zmq_connect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了zmq_connect函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Connect

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

示例2: Connect

/*
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
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:13,代碼來源:zmq3.go

示例3: Connect

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

示例4: Connect

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

示例5: Connect

func Connect(socket ZSocket, endpoint string) os.Error {
	return handle(C.zmq_connect(socket.Ptr, C.CString(endpoint)))
}
開發者ID:badgerodon,項目名稱:zmq,代碼行數:3,代碼來源:zmq.go

示例6: Connect

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


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