Skip to content

Commit

Permalink
翻译的Figure #9
Browse files Browse the repository at this point in the history
  • Loading branch information
erning committed Oct 11, 2011
1 parent 65e5c99 commit 4b276e9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 50 deletions.
99 changes: 49 additions & 50 deletions chapter1.txt
Expand Up @@ -1084,76 +1084,75 @@ wuclient 56789 &
```textdiagram
+-----------------+
| |
| I'm not getting |
| my data! |
| 我获取不到数据! |
| |
| {o} |
+--------+--------+
|
|
v
+-----------------+ +-----------------+ +------------------+
| | | | | Use the |
| Are you losing | | Do you set a | | zmq_setsockopt |
| messages in a +------->| subscription +------->| ZMQ_SUBSCRIBE |
| SUB socket? | Yes | for messages? | No | ("") option |
| {o} | | {o} | | |
| | | | | 使用函数 |
| 你是在从SUB套接 | | 有没有设置消息 | | zmq_setsockopt() |
| 字获取消息吗? +------->| 订阅信息? +------->| 设置 |
| | Yes | | No | ZMQ_SUBSCRIBE |
| {o} | | {o} | | 为空字符串 |
+--------+--------+ +--------+--------+ +------------------+
| No | Yes
| |
| v
| +-----------------+ +------------------+
| | | | Start all SUB |
| | Do you start | | sockets first, |
| | the SUB socket +------->| then the PUB |
| | after the PUB? | No | sockets to avoid |
| | {o} | | loss |
| | | | 先打开所有SUB套接|
| | 是否在PUB之后 | | 字,再打开PUB,以|
| | 启动SUB? +------->| 避免消息丢失。 |
| | | No | |
| | {o} | | |
| +--------+--------+ +------------------+
| | Yes
| |
| v
| +-------------------------+
| | See explanation of the |
| | "slow joiner" syndrome |
| | syndrome in this text. |
| | 请查看关于"慢链接"的 |
| | 解释 |
| | |
| +-------------------------+
|
|
v
+-----------------+ +--------------------+
| | | With REQ, send and |
| Are you using | | recv in a loop and |
| REQ and REP +------->| check the return |
| sockets? | Yes | codes. With REP |
| {o} | | it's recv + send. |
| | | REQ套接字中,执行 |
| 是否在使用REQ | | send和recv,查看返 |
| 和REP套接字? +------->| 回结果。 |
| | Yes | REP套接字中,执行 |
| {o} | | recv和send。 |
+--------+--------+ +--------------------+
| No
|
v
+-----------------+ +---------------------+ +-----------------+
| | | The 1st PULL socket | | You may need to |
| Are you using | | to connect can grab | | do extra work to|
| PUSH sockets? +------->| 1000's of messages +------->| synchronize your|
| | Yes | before the others | | sockets before |
| {o} | | get there. | | sending tasks. |
| | | 第一个连接成功的 | | 在发送任务之前 |
| 是否在使用PUSH | | PULL可能将所有任务 | | 需要额外的工作 |
| 套接字? +------->| 都接收下了,其他 +------->| 来同步套接字。 |
| {o} | | PULL接收不到。 | | |
+--------+--------+ +---------------------+ +-----------------+
| No
|
v
+-----------------+ +-----------------+
| | | |
| Do you check | | Check every 0MQ |
| return codes on +------->| method call. In |
| all methods? | No | C, use asserts. |
| 是否检查了所有 | | 检查所有ZMQ方法 |
| 返回码? +------->| 的返回码,C语言 |
| | No | 中用assert断言。|
| {o} | | |
+--------+--------+ +-----------------+
| Yes
|
v
+-----------------+ +-----------------+ +------------------+
| | | | | |
| Are you using | | Do you pass | | Create a socket |
| threads in your +------->| sockets between +------->| in the thread |
| app already? | Yes | threads? | Yes | where you use it |
| 是否在应用程序 | | 有没有在线程间 | | 为线程创建各自的 |
| 中使用了多线程? +------->| 传递套接字对象? +------->| 套接字对象。 |
| | Yes | | | |
| {o} | | {o} | | |
+--------+--------+ +--------+--------+ +------------------+
| No | No
Expand All @@ -1162,48 +1161,48 @@ wuclient 56789 &
v
+-----------------+ +-----------------+ +------------------+
| | | | | |
| Are you using | | Are you calling | | Call zmq_init |
| the inproc +------->| zmq_init more +------->| exactly once in |
| transport? | Yes | than once? | Yes | every process. |
| 是否使用了inproc| | 是否多次调用了 | | 每个进程只调用一 |
| 传输协议? +------->| zmq_init()? +------->| 次zmq_init()。 |
| | Yes | | Yes | |
| {o} | | {o} | | |
+--------+--------+ +--------+--------+ +------------------+
| No | No
| |
| v
| +-----------------+
| | |
| | Check that you |
| | bind before you |
| | connect. |
| | 检查是否事先绑 |
| | 定到端点再连接 |
| | 到端点。 |
| | |
| +-----------------+
|
v
+-----------------+ +-----------------+ +-----------------+
| | | Check that the | | If you're using |
| Are you using | | reply address | | identities make |
| ROUTER sockets? +------->| is valid. 0MQ +------->| sure to set them|
| | Yes | drops messages | | before not after|
| {o} | | it can't route. | | you connect. |
| | | 检查应当地址是否| | 若使用了持久化套|
| 是否使用了 | | 合法的。ZMQ回直 | | 接字标识,检查它|
| ROUTER套接字? +------->| 接丢弃无法路由的+------->| 是否在连接之前设|
| | Yes | 消息。 | | 置的,而非连接后|
| {o} | | | | |
+--------+--------+ +-----------------+ +--------+--------+
| No
|
v
+-----------------+ +--------------------+
| | | You probably have |
| Are you losing | | a client running |
| one message +------->| in the background. |
| in two? | Yes | Kill it and start |
| {o} | | again. |
| | | |
| 是否只有零星的 | | 可能后台有其他客户 |
| 消息丢失? +------->| 端在运行,找出来并 |
| | Yes | 终止它。 |
| {o} | | |
+--------+--------+ +--------------------+
| No
|
v
+-----------------+
| |
| Make a minimal |
| test case, ask |
| on zeromq IRC. |
| 写一个最简单的测|
| 试用例,到ZMQ的 |
| IRC频道上求助。 |
| |
+-----------------+
Expand Down
Binary file modified images/chapter1_9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4b276e9

Please sign in to comment.