• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang zmq4.NewContext函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/pebbe/zmq4.NewContext函数的典型用法代码示例。如果您正苦于以下问题:Golang NewContext函数的具体用法?Golang NewContext怎么用?Golang NewContext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewContext函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: InitSocket

func (this *Spout) InitSocket(pull, push string) (err error) {
	var reader, writer *zmq.Context
	reader, err = zmq.NewContext()
	if err != nil {
		return
	}

	this.Component.Reader, err = reader.NewSocket(zmq.PULL)
	if err != nil {
		return
	}

	err = this.Component.Reader.Connect("tcp://127.0.0.1:" + pull)
	if err != nil {
		return
	}

	writer, err = zmq.NewContext()
	if err != nil {
		return
	}

	this.Component.Writer, err = writer.NewSocket(zmq.PUSH)
	if err != nil {
		return
	}

	err = this.Component.Writer.Bind("tcp://127.0.0.1:" + push)
	return
}
开发者ID:HearingFish,项目名称:gostorm,代码行数:30,代码来源:spout.go


示例2: BindPublisher

func BindPublisher(endpoint string) *GlcZmq {
	context, err := zmq.NewContext()

	if err != nil {
		log.Fatal(err)
	}

	socket, err := context.NewSocket(zmq.PUB)

	if err != nil {
		log.Fatal(err)
	}

	go func(socket *zmq.Socket, endpoint string) {
		defer socket.Close()
		err = socket.Connect(endpoint)

		if err != nil {
			log.Fatal(err)
		}

		for {
			time.Sleep(1 * time.Second)
		}
	}(socket, endpoint)

	return &GlcZmq{socket}
}
开发者ID:matthewvalimaki,项目名称:glc,代码行数:28,代码来源:zmq.go


示例3: BindSubscriber

func BindSubscriber(endpoint string, filter string, callback func(message string)) *GlcZmq {
	context, err := zmq.NewContext()

	socket, err := context.NewSocket(zmq.PUB)
	defer socket.Close()

	if err != nil {
		log.Fatal(err)
	}

	err = socket.Connect(endpoint)

	if err != nil {
		log.Fatal(err)
	}

	for {
		msg, _ := socket.Recv(zmq.DONTWAIT)

		if msg != "" {
			callback(msg)
		}
	}

	return &GlcZmq{socket}
}
开发者ID:matthewvalimaki,项目名称:glc,代码行数:26,代码来源:zmq.go


示例4: NewCommunicator

// Initiate connections to all replicas
func NewCommunicator(name string, replicas map[string]*ReplicaInfo) (*Communicator, error) {
	communicator := new(Communicator)
	context, err := zmq.NewContext()
	if err != nil {
		return nil, err
	}
	communicator.context = context
	communicator.pubSocket, err = context.NewSocket(zmq.PUB)
	if err != nil {
		return nil, err
	}
	communicator.subSocket, err = context.NewSocket(zmq.SUB)
	communicator.chunkSocket, err = context.NewSocket(zmq.REP)
	for key, val := range replicas {
		if replicas[key].Name == name {
			communicator.pubSocket.Bind("tcp://*:" + val.Port)
			communicator.chunkSocket.Bind("tcp://*:" + val.DemandPort)
			communicator.tag = val.Pid
		} else {
			communicator.subSocket.Connect("tcp://" + val.IpAddr + ":" + val.Port)
			communicator.subSocket.SetSubscribe(val.Pid)
		}
	}
	communicator.replicas = replicas
	return communicator, nil
}
开发者ID:slunk,项目名称:Distributed-Storage-Systems,代码行数:27,代码来源:replication.go


示例5: BindProxy

func BindProxy(frontend string, backend string) {
	context, err := zmq.NewContext()

	if err != nil {
		log.Fatal(err)
	}

	// create XSUB for publishers to connect to
	xSub, _ := context.NewSocket(zmq.XSUB)
	defer xSub.Close()
	err = xSub.Bind(frontend)
	if err != nil {
		log.Fatal(err)
	}

	// create XPUB for subscribers to connect to
	xPub, _ := context.NewSocket(zmq.XPUB)
	defer xPub.Close()

	err = xPub.Bind(backend)
	if err != nil {
		log.Fatal(err)
	}

	err = zmq.Proxy(xSub, xPub, nil)

	log.Fatalln("Proxy interrupted:", err)
}
开发者ID:matthewvalimaki,项目名称:glc,代码行数:28,代码来源:zmq.go


示例6: createSockets

// createSockets sets up the 0MQ sockets through which the kernel will
// communicate.
func createSockets(connInfo *ConnectionInfo) (*zmq.Context, *sockets, error) {
	context, err := zmq.NewContext()
	if err != nil {
		return nil, nil, err
	}

	bindSocket := func(t zmq.Type, port int) (*zmq.Socket, error) {
		addr := fmt.Sprintf(
			"%s://%s:%v", connInfo.Transport, connInfo.IP, port,
		)
		socket, err := context.NewSocket(t)
		if err != nil {
			return nil, err
		}
		if err := socket.Bind(addr); err != nil {
			socket.Close()
			return nil, err
		}
		return socket, nil
	}

	var sockets sockets
	var heartbeatSocket *zmq.Socket

	socketPorts := []struct {
		Name   string
		Port   int
		Type   zmq.Type
		Socket **zmq.Socket
	}{
		{"heartbeat", connInfo.HeartbeatPort, zmq.REP, &heartbeatSocket},
		{"shell", connInfo.ShellPort, zmq.ROUTER, &sockets.Shell},
		{"control", connInfo.ControlPort, zmq.ROUTER, &sockets.Control},
		{"stdin", connInfo.StdinPort, zmq.ROUTER, &sockets.Stdin},
		{"iopub", connInfo.IOPubPort, zmq.PUB, &sockets.IOPub},
	}
	for _, socketPort := range socketPorts {
		socket, err := bindSocket(socketPort.Type, socketPort.Port)
		if err != nil {
			// TODO(axw) do we need to close all sockets if one
			// fails? Is terminating the context good enough?
			if err := context.Term(); err != nil {
				log.Printf("terminating context: %v", err)
			}
			return nil, nil, fmt.Errorf(
				"creating %v socket: %v", socketPort.Name, err,
			)
		}
		*socketPort.Socket = socket
	}

	go zmq.Proxy(heartbeatSocket, heartbeatSocket, nil)
	return context, &sockets, nil
}
开发者ID:go-daw,项目名称:go-jupyter,代码行数:56,代码来源:kernel.go


示例7: Init

/******************************************************************************
* 概述:     Zmq初始化
* 函数名:    Init
* 返回值:    error
* 参数列表:  参数名          参数类型      取值范围     描述
*
*******************************************************************************/
func (this *Zmq) Init(dataCache *DataCache, event *Event) error {
	this.MdataCache = dataCache
	this.Mevent = event
	if this.Mcontext != nil {
		return nil
	}
	context, err := zmq4.NewContext()
	if err != nil {
		return err
	}
	this.Mcontext = context
	return nil
}
开发者ID:EdXu,项目名称:Service-discovery-service-sds-,代码行数:20,代码来源:sdk_socket.go


示例8: New

func New(addr string) (*Router, error) {
	ctx, err := zmq.NewContext()
	if err != nil {
		return nil, err
	}
	router := &Router{
		ctx:       ctx,
		receivers: make(map[*zmq.Socket]*receiver),
		poller:    zmq.NewPoller(),
		addr:      addr,
	}

	return router, nil
}
开发者ID:a-palchikov,项目名称:kron,代码行数:14,代码来源:router.go


示例9: setSock

func (this *sock) setSock(pattern zmq.Type) {
	var err error
	this.ctx, err = zmq.NewContext()
	if err != nil {
		panic(err)
	}

	this.zmqSock, err = zmq.NewSocket(pattern)
	if err != nil {
		panic(err)
	}

	this.initialiser.init(this.zmqSock)
}
开发者ID:x8lucas8x,项目名称:go-zeroless,代码行数:14,代码来源:sock.go


示例10: main

func main() {
	context, _ := zmq.NewContext()

	server, _ := context.NewSocket(zmq.REP)
	defer server.Close()

	server.Bind(SERVER_END)

	for cycles := 1; ; cycles++ {
		request, _ := server.Recv(0)
		fmt.Printf("Request (%d) : (%s)\n", cycles, request)
		server.Send(request, 0)
	}
}
开发者ID:TUArjun,项目名称:go_test_code,代码行数:14,代码来源:zmq1.go


示例11: createSockets

// createSockets sets up the 0MQ sockets through which the kernel will
// communicate.
func createSockets(connInfo *ConnectionInfo) (*zmq.Context, *sockets, error) {
	context, err := zmq.NewContext()
	if err != nil {
		return nil, nil, err
	}

	bindSocket := func(t zmq.Type, port int) (*zmq.Socket, error) {
		addr := fmt.Sprintf(
			"%s://%s:%v", connInfo.Transport, connInfo.IP, port,
		)
		socket, err := context.NewSocket(t)
		if err != nil {
			return nil, err
		}
		if err := socket.Bind(addr); err != nil {
			socket.Close()
			return nil, err
		}
		return socket, nil
	}

	sockets := sockets{
		Heartbeat: socket{Name: "heartbeat", Port: connInfo.HeartbeatPort, Type: zmq.REP},
		Shell:     socket{Name: "shell", Port: connInfo.ShellPort, Type: zmq.ROUTER},
		Control:   socket{Name: "control", Port: connInfo.ControlPort, Type: zmq.ROUTER},
		Stdin:     socket{Name: "stdin", Port: connInfo.StdinPort, Type: zmq.ROUTER},
		IOPub:     socket{Name: "iopub", Port: connInfo.IOPubPort, Type: zmq.PUB},
	}

	for _, socketPtr := range sockets.sockets() {
		socket, err := bindSocket(socketPtr.Type, socketPtr.Port)
		if err == nil {
			socketPtr.Socket = socket
			err = socket.SetLinger(0)
		}
		if err != nil {
			sockets.tryClose()
			if err := context.Term(); err != nil {
				log.Printf("error terminating context: %v", err)
			}
			return nil, nil, fmt.Errorf(
				"creating %v socket: %v", socketPtr.Name, err,
			)
		}
	}

	go zmq.Proxy(sockets.Heartbeat.Socket, sockets.Heartbeat.Socket, nil)
	return context, &sockets, nil
}
开发者ID:axw,项目名称:go-jupyter,代码行数:51,代码来源:kernel.go


示例12: NewQueue

// New acts as a queue constructor
func NewQueue(uri string) (Queue, error) {
	u := "tcp://" + uri
	c, _ := zmq.NewContext()

	pullSoc, pullErr := c.NewSocket(zmq.PULL)
	if pullErr != nil {
		return Queue{}, fmt.Errorf("pull socket initialization failed: %v", pullErr)
	}
	pushSoc, pushErr := c.NewSocket(zmq.PUSH)
	if pushErr != nil {
		return Queue{}, fmt.Errorf("push socket initialization failed: %v", pushErr)
	}

	q := Queue{u, pushSoc, pullSoc}
	return q, nil
}
开发者ID:johnhof,项目名称:metre,代码行数:17,代码来源:queue.go


示例13: createPushServer

func createPushServer(impl *server) error {
	ctx, err := zmq.NewContext()
	if err != nil {
		return err
	}
	socket, err := ctx.NewSocket(zmq.PUB)
	if err != nil {
		return err
	}
	if err = socket.Bind(fmt.Sprintf("tcp://*:%d", *pushPort)); err != nil {
		return err
	}
	impl.socket = socket
	log.Printf("PUSH service on %d", *pushPort)
	impl.start()
	return nil
}
开发者ID:a-palchikov,项目名称:kron,代码行数:17,代码来源:main.go


示例14: main

func main() {

	context, _ := zmq.NewContext()

	fmt.Println("Connecting to server .... ")

	client, _ := context.NewSocket(zmq.REQ)

	client.Connect(SERVER_ENDPOINT)

	for i := 0; i < 10; i++ {
		msg := fmt.Sprintf("msg %d", i)
		client.Send((msg), 0)
		fmt.Println("Sending Message ", msg)
		client.Recv(0)
	}

}
开发者ID:TUArjun,项目名称:go_test_code,代码行数:18,代码来源:zmqs.go


示例15: newDealer

func newDealer() *dealer {
	ctx, _ := zmq.NewContext()

	msgCh := make(chan string)
	doneCh := make(chan bool)
	errCh := make(chan error)

	client, err := ctx.NewSocket(zmq.DEALER)

	if err != nil {
		logger.Error.Println("Error openinng DEALER	socket", err)
		os.Exit(1)
	}

	return &dealer{
		ctx:    ctx,
		msgCh:  msgCh,
		doneCh: doneCh,
		errCh:  errCh,
		client: client,
	}
}
开发者ID:redsofa,项目名称:zmq-soundtouch,代码行数:22,代码来源:zmqdealer.go


示例16: Dial

// Dial connects to a zrpc server at the specified network address
// Protocol is limited to tcp
func Dial(address ...string) (*Client, error) {
	// Don't use the global context to avoid package level confusion
	ctx, err := zmq.NewContext()
	if err != nil {
		glog.Fatal(err)
	}
	// A dealer socket handles the actual connection
	socket, err := ctx.NewSocket(zmq.DEALER)
	if err != nil {
		glog.Fatal(err)
	}

	client := NewClientWithConnection(ctx, socket)

	for _, addr := range address {
		if err := client.endpoints.add(addr); err != nil {
			return nil, err
		}
	}

	return client, nil
}
开发者ID:gust1n,项目名称:zrpc,代码行数:24,代码来源:client.go


示例17: NewCommunicator

// Initiate connections to all replicas
func NewCommunicator(name string, replicas map[string]*ReplicaInfo) (*Communicator, error) {
	communicator := new(Communicator)
	context, err := zmq.NewContext()
	if err != nil {
		return nil, err
	}
	communicator.context = context
	communicator.pubSocket, err = context.NewSocket(zmq.PUB)
	if err != nil {
		return nil, err
	}
	communicator.subSocket, err = context.NewSocket(zmq.SUB)
	communicator.chunkSocket, err = context.NewSocket(zmq.REP)
	communicator.raftPubSocket, err = context.NewSocket(zmq.PUB)
	communicator.raftSubSocket, err = context.NewSocket(zmq.SUB)
	communicator.raftPointToPointSocket, err = context.NewSocket(zmq.REP)
	communicator.raftClientSocket, err = context.NewSocket(zmq.REP)
	found := false
	for _, val := range replicas {
		if !found && ((name == "auto" && (val.IpAddr == "localhost" || IsOurIpAddr(val.IpAddr))) || val.Name == name) {
			communicator.pubSocket.Bind("tcp://*:" + val.Port)
			communicator.chunkSocket.Bind("tcp://*:" + val.DemandPort)
			// raft
			communicator.raftPubSocket.Bind("tcp://*:" + val.RaftPubPort)
			communicator.raftPointToPointSocket.Bind("tcp://*:" + val.RaftP2PPort)
			communicator.raftClientSocket.Bind("tcp://*:" + val.RaftClientPort)
			communicator.tag = val.Pid
			found = true
		} else {
			communicator.subSocket.Connect("tcp://" + val.IpAddr + ":" + val.Port)
			communicator.subSocket.SetSubscribe(val.Pid)
			communicator.raftSubSocket.Connect("tcp://" + val.IpAddr + ":" + val.RaftPubPort)
			communicator.raftSubSocket.SetSubscribe(val.Pid)
		}
	}
	communicator.replicas = replicas
	return communicator, nil
}
开发者ID:slunk,项目名称:Distributed-Storage-Systems,代码行数:39,代码来源:communication.go


示例18: TestServiceDispatcher

func TestServiceDispatcher(t *testing.T) {
	numPeers := 10
	numServices := 10

	var c *zmq.Context
	var sd *svcrouter.ServiceDispatcher
	var socks []*zmq.Socket = make([]*zmq.Socket, numPeers)
	var addr []string = make([]string, numPeers)
	var killReflectors []chan bool = make([]chan bool, numPeers)
	var err error
	var wg sync.WaitGroup

	defer func() {
		for _, s := range socks {
			if s != nil {
				s.Close()
			}
		}
		if sd != nil {
			sd.Close()
		}
		if c != nil {
			c.Term()
		}
	}()

	if c, err = zmq.NewContext(); err != nil {
		t.Fatalf("Failed to create ZMQ context: %v", err)
	}

	if sd, err = svcrouter.NewServiceDispatcher(c, 1); err != nil {
		t.Fatalf("Failed to create a new service dispatcher: %v", err)
	}

	sd.NoEnvRouterPeer = dummyPeerName(0)
	sd.EnvRouterPeer = dummyPeerName(2)

	for np := 0; np < numPeers; np++ {
		if np%2 == 0 {
			name := fmt.Sprintf("C%04d st=ST%d si=x", np, (np/2)%2)
			if socks[np], addr[np], err = svcrouter.NewSocketAndAddress(c, true, zmq.REQ, name); err != nil {
				t.Fatalf("Failed to create half pair A: %v", err)
			}
			if err = sd.AddPeer(svcrouter.PeerDefinition{
				Name:    dummyPeerName(np),
				ZmqType: zmq.ROUTER,
				Address: addr[np],
				Bind:    false,
			}, svcrouter.PT_CLIENTSNOENV); err != nil {
				t.Fatalf("Could not add peer %d: %v", np, err)
			}
		} else {
			name := fmt.Sprintf("C%04d st=ST%d si=x", np, ((np-1)/2)%2)
			if socks[np], addr[np], err = svcrouter.NewSocketAndAddress(c, true, zmq.REP, name); err != nil {
				t.Fatalf("Failed to create half pair A: %v", err)
			}
			if err = sd.AddPeer(svcrouter.PeerDefinition{
				Name:    dummyPeerName(np),
				ZmqType: zmq.DEALER,
				Address: addr[np],
				Bind:    false,
			}, svcrouter.PT_DOWNSTREAMENVREP); err != nil {
				t.Fatalf("Could not add peer %d: %v", np, err)
			}
			killReflectors[np] = reflector(t, socks[np], np, &wg)
		}
	}

	svcrouter.Barrier()

	for np := 1; np < numPeers; np += 2 {
		for ns := 0; ns < numServices; ns++ {
			serviceType := fmt.Sprintf("ST%d", ns)
			serviceId := "x"
			e := svcrouter.NewEndpointEnvelope(serviceType, serviceId, "")
			if err := sd.AddService(sd.RouterElement, dummyPeerName(np), e); err != nil {
				t.Fatalf("Could not add service %d to peer %d: %v", ns, np, err)
			}
		}
	}

	msg := [][]byte{[]byte("Hello"), []byte("World")}

	for it := 0; it < 2; it++ {
		if _, err := socks[0].SendMessage(msg); err != nil {
			t.Fatalf("socks send error: %v", err)
		}
		if msg2, err := socks[0].RecvMessageBytes(0); err != nil {
			t.Fatalf("socks receive error: %v", err)
		} else {
			svcrouter.DumpMsg("FINAL", msg2)
			if !msgEqual(msg, msg2) {
				t.Fatalf("socks messages differ")
			}
		}
	}

	for _, v := range killReflectors {
		if v != nil {
			close(v)
//.........这里部分代码省略.........
开发者ID:abligh,项目名称:ghostfish,代码行数:101,代码来源:servicedispatcher_test.go


示例19: TestMultipleContexts

func TestMultipleContexts(t *testing.T) {

	chQuit := make(chan interface{})
	chErr := make(chan error, 2)
	needQuit := false
	var sock1, sock2, serv1, serv2 *zmq.Socket
	var serv_ctx1, serv_ctx2, ctx1, ctx2 *zmq.Context
	var err error

	defer func() {
		if needQuit {
			chQuit <- true
			chQuit <- true
			<-chErr
			<-chErr
		}
		for _, s := range []*zmq.Socket{sock1, sock2, serv1, serv2} {
			if s != nil {
				s.SetLinger(0)
				s.Close()
			}
		}
		for _, c := range []*zmq.Context{serv_ctx1, serv_ctx2, ctx1, ctx2} {
			if c != nil {
				c.Term()
			}
		}
	}()

	addr1 := "tcp://127.0.0.1:9997"
	addr2 := "tcp://127.0.0.1:9998"

	serv_ctx1, err = zmq.NewContext()
	if err != nil {
		t.Fatal("NewContext:", err)
	}
	serv1, err = serv_ctx1.NewSocket(zmq.REP)
	if err != nil {
		t.Fatal("NewSocket:", err)
	}
	err = serv1.Bind(addr1)
	if err != nil {
		t.Fatal("Bind:", err)
	}

	serv_ctx2, err = zmq.NewContext()
	if err != nil {
		t.Fatal("NewContext:", err)
	}
	serv2, err = serv_ctx2.NewSocket(zmq.REP)
	if err != nil {
		t.Fatal("NewSocket:", err)
	}
	err = serv2.Bind(addr2)
	if err != nil {
		t.Fatal("Bind:", err)
	}

	new_service := func(sock *zmq.Socket, addr string) {
		socket_handler := func(state zmq.State) error {
			msg, err := sock.RecvMessage(0)
			if err != nil {
				return err
			}
			_, err = sock.SendMessage(addr, msg)
			return err
		}
		quit_handler := func(interface{}) error {
			return errors.New("quit")
		}

		reactor := zmq.NewReactor()
		reactor.AddSocket(sock, zmq.POLLIN, socket_handler)
		reactor.AddChannel(chQuit, 1, quit_handler)
		err = reactor.Run(100 * time.Millisecond)
		chErr <- err
	}

	go new_service(serv1, addr1)
	go new_service(serv2, addr2)
	needQuit = true

	time.Sleep(time.Second)

	// default context

	sock1, err = zmq.NewSocket(zmq.REQ)
	if err != nil {
		t.Fatal("NewSocket:", err)
	}
	sock2, err = zmq.NewSocket(zmq.REQ)
	if err != nil {
		t.Fatal("NewSocket:", err)
	}
	err = sock1.Connect(addr1)
	if err != nil {
		t.Fatal("sock1.Connect:", err)
	}
	err = sock2.Connect(addr2)
	if err != nil {
//.........这里部分代码省略.........
开发者ID:pebbe,项目名称:zmq4,代码行数:101,代码来源:zmq4_test.go


示例20: Example_multiple_contexts

func Example_multiple_contexts() {
	chQuit := make(chan interface{})
	chReactor := make(chan bool)

	addr1 := "tcp://127.0.0.1:9997"
	addr2 := "tcp://127.0.0.1:9998"

	serv_ctx1, err := zmq.NewContext()
	if checkErr(err) {
		return
	}
	serv1, err := serv_ctx1.NewSocket(zmq.REP)
	if checkErr(err) {
		return
	}
	err = serv1.Bind(addr1)
	if checkErr(err) {
		return
	}
	defer func() {
		serv1.Close()
		serv_ctx1.Term()
	}()

	serv_ctx2, err := zmq.NewContext()
	if checkErr(err) {
		return
	}
	serv2, err := serv_ctx2.NewSocket(zmq.REP)
	if checkErr(err) {
		return
	}
	err = serv2.Bind(addr2)
	if checkErr(err) {
		return
	}
	defer func() {
		serv2.Close()
		serv_ctx2.Term()
	}()

	new_service := func(sock *zmq.Socket, addr string) {
		socket_handler := func(state zmq.State) error {
			msg, err := sock.RecvMessage(0)
			if checkErr(err) {
				return err
			}
			_, err = sock.SendMessage(addr, msg)
			if checkErr(err) {
				return err
			}
			return nil
		}
		quit_handler := func(interface{}) error {
			return errors.New("quit")
		}

		defer func() {
			chReactor <- true
		}()

		reactor := zmq.NewReactor()
		reactor.AddSocket(sock, zmq.POLLIN, socket_handler)
		reactor.AddChannel(chQuit, 1, quit_handler)
		err = reactor.Run(100 * time.Millisecond)
		fmt.Println(err)
	}

	go new_service(serv1, addr1)
	go new_service(serv2, addr2)

	time.Sleep(time.Second)

	// default context

	sock1, err := zmq.NewSocket(zmq.REQ)
	if checkErr(err) {
		return
	}
	sock2, err := zmq.NewSocket(zmq.REQ)
	if checkErr(err) {
		return
	}
	err = sock1.Connect(addr1)
	if checkErr(err) {
		return
	}
	err = sock2.Connect(addr2)
	if checkErr(err) {
		return
	}
	_, err = sock1.SendMessage(addr1)
	if checkErr(err) {
		return
	}
	_, err = sock2.SendMessage(addr2)
	if checkErr(err) {
		return
	}
	msg, err := sock1.RecvMessage(0)
//.........这里部分代码省略.........
开发者ID:rdterner,项目名称:zmq4,代码行数:101,代码来源:zmq4_test.go



注:本文中的github.com/pebbe/zmq4.NewContext函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang zmq4.NewPoller函数代码示例发布时间:2022-05-28
下一篇:
Golang zmq3.Socket类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap