1. 程式人生 > >ZeroMQ介面函式之 :zmq_disconnect

ZeroMQ介面函式之 :zmq_disconnect

zmq_disconnect(3)     ØMQ Manual - ØMQ/3.2.5

Name

zmq_disconnect - 斷開一個socket的連線

Synopsis

int zmq_disconnect (void *socket, const char *endpoint);

Description

函式zmq_disconnect() 會斷開socket引數指定的socket與endpoint引數指定的終結點的連線。

endpoint引數和在zmq_connect(3)函式中有詳細描述。

Return value

如果zmq_disconnect()函式執行成功,則返回0。否則返回 -1,並設定errno為下列指定值。

Errors

  EINVAL

    引數endpoint指定的終結點不可用。

  ETERM 

    和當前soocket相聯絡的context被終結了。

  ENOTSOCK

    引數socket不可用。

  ENOENT

    socket並沒有連線引數endpoint的終結點。

Example

用一個scoket連線廣播、程序內和TCP連線。

1 /* Create a ZMQ_SUB socket */
2 void *socket = zmq_socket (context, ZMQ_SUB);
3 assert (socket);
4 /*
Connect it to the host server001, port 5555 using a TCP transport */ 5 rc = zmq_connect (socket, "tcp://server001:5555"); 6 assert (rc == 0); 7 /* Disconnect from the previously connected endpoint */ 8 rc = zmq_disconnect (socket, "tcp://server001:5555"); assert (rc == 0);

See also

zmq_connect(3)  zmq_socket(3)  zmq(7)

Authors

This ØMQ manual page was written by Martin Sustrik <[email protected]>, Martin Lucina

Web site design and content is copyright (c) 2007-2012 iMatix Corporation. Contact us for professional support. Site content licensed under the Creative Commons Attribution-Share Alike 3.0 License. ØMQ is copyright (c) Copyright (c) 2007-2012 iMatix Corporation and Contributors. ØMQ is free software licensed under the LGPL. ØMQ, ZeroMQ, and 0MQ are trademarks of iMatix Corporation. Terms of Use — Privacy

Policy

翻譯:風波

mail : [email protected]