ZeroMQ API 目錄 :http://www.cnblogs.com/fengbohello/p/4230135.html
—————————————————————————————————————
ZeroMQ 官方地址:http://api.zeromq.org/3-2:zmq-ipc
zmq_ipc(7) ØMQ Manual - ØMQ/3.2.5
Name
zmq_ipc – ZMQ本地進程間通信傳輸協議
Synopsis
進程間傳輸采用與系統相關的IPC機制進行本地進程間的消息通信。
進程間傳輸方式目前只在提供UNIX定義的socket系統上完全的實現了。
Addressing
一個終結點包括transport://跟着一個address (對於IPC也就是 ipc://address)。transport指定了要使用的底層的系統協議。address指定了需要連接的指定地址。
對於進程間的傳輸,transport指的是ipc,address部分在下面進行定義。
綁定一個socket
當使用zmq_bind()函數以ipc傳輸方式綁定一個本地socket的時候,終結點應該是一個任意字符串的文件名,能夠唯一標志將要創建的文件。文件名應該是在使用ipc進行操作是,這個操作系統名稱空間中唯一的。這個文件名還必須滿足操作系統對正常文件名在格式和長度上的限制。
當地址是*的時候,zmq_bind()函數會生成一個臨時的文件名。調用者需要使用ZMQ_LAST_ENDPOINT屬性獲取此文件名。查看zmq_getsockopt(3)函數獲取更多細節。
所有綁定在一個已經存在的文件名的動作都會被重載。在這種情況下,ipc協議和tcp或者inproc協議是不一樣的。
連接一個socket
當使用zmq_connect()函數向一個對端發起ipc連接的時候,終結點需要是一個能夠唯一標志一個文件名的任意字符串。這個文件名必須是已經由操作系統創建,並且被分配給了一個通過zmq_bind()操作過的socket。
Examples
給一個socket分配一個地址
// Assign the pathname "/tmp/feeds/0"
rc = zmq_bind(socket, "ipc:///tmp/feeds/0"); assert (rc == 0);
連接一個socket
// Connect to the pathname "/tmp/feeds/0"
rc = zmq_connect(socket, "ipc:///tmp/feeds/0"); assert (rc == 0);
See also
zmq_bind(3) zmq_connect(3) zmq_inproc(7) zmq_tcp(7) zmq_pgm(7) zmq_getsockopt(3) zmq(7)
Authors
This ØMQ manual page was written by Pieter Hintjens <ph@imatix.com>, Martin Sustrik <sustrik@250bpm.com> and Martin Lucina <mato@kotelna.sk>.
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 : fengbohello@qq.com
