File: 03-example.tex

package info (click to toggle)
r-cran-pbdzmq 0.3.13%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 856 kB
  • sloc: ansic: 737; sh: 93; pascal: 30; cpp: 6; makefile: 4
file content (53 lines) | stat: -rw-r--r-- 1,704 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
\section[Examples]{Examples}
\label{sec:examples}
\addcontentsline{toc}{section}{\thesection. Examples}

The package provides several simple examples based on \emph{the ZeroMQ guide 
for C developers} by Pieter Hintjens~\citep{Hintjens}.  These are located in 
the \code{demo/} subdirectory of the \pkg{pbdZMQ}
package source, and they include:\\
\begin{center}
\vspace{0.2cm}
\begin{tabular}{ll} \hline\hline
Examples & Descriptions \\ \hline
\code{hwclient.r} & hello world client \\
\code{hwserver.r} & hello world server \\ \hline

\code{tasksink.r} & task sink from two workers \\
\code{taskvent.r} & task ventilator send jobs to two workers \\
\code{taskwork.r} & task workers \\ \hline

\code{wuclient.r} & weather updating client \\
\code{wuserver.r} & weather updating server \\ \hline

\code{mspoller.r} & using poller to receive messages from multiple sockets \\
\code{msreader.r} & receive messages from multiple sockets \\ \hline

\code{mpclient.r} & hello world client in mpltiple part version \\
\code{mpserver.r} & hello world server in mpltiple part version \\ \hline
\hline

\end{tabular}
\end{center}

For instance, the task examples can be run by
\begin{Command}
Rscript taskwork.r &
Rscript taskvent.r
Rscript tasksink.r

### Remember to kill two worker processors at the end, such as
ps -x|grep "file=task.*\.r"|sed "s/\(.*\) pts.*/\1/"|xargs kill -9
\end{Command}
Or, via \code{demo()} function as the hello world example in
Section~\ref{sec:installation}.

The weather updating examples can be run by
\begin{Command}
Rscript wuserver.r &
Rscript wuclient.r
rm weather.ipc
\end{Command}
Or, via \code{demo()} function as the hello world example in
Section~\ref{sec:installation}.