| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/opts.R |
| 3 |
\name{survey_time} |
| 4 |
\alias{survey_time} |
| 5 |
\title{Set Survey Time} |
| 6 |
\usage{ |
| 7 |
survey_time(con, value = 1000L) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{con}{a Socket or Context using the 'surveyor' protocol.} |
| 11 |
|
| 12 |
\item{value}{[default 1000L] integer survey timeout in milliseconds.} |
| 13 |
} |
| 14 |
\value{ |
| 15 |
Invisibly, the passed Socket or Context. |
| 16 |
} |
| 17 |
\description{ |
| 18 |
For a socket or context using the surveyor protocol in a surveyor/respondent |
| 19 |
pattern. Set the survey timeout in milliseconds (remains valid for all |
| 20 |
subsequent surveys). Messages received by the surveyor after the timer has |
| 21 |
ended are discarded. |
| 22 |
} |
| 23 |
\details{ |
| 24 |
After using this function, to start a new survey, the surveyor must: |
| 25 |
\itemize{ |
| 26 |
\item send a message. |
| 27 |
\item switch to receiving responses. |
| 28 |
} |
| 29 |
|
| 30 |
To respond to a survey, the respondent must: |
| 31 |
\itemize{ |
| 32 |
\item receive the survey message. |
| 33 |
\item send a reply using \code{\link[=send_aio]{send_aio()}} before the survey has timed out (a |
| 34 |
reply can only be sent after receiving a survey). |
| 35 |
} |
| 36 |
} |
| 37 |
\examples{ |
| 38 |
sur <- socket("surveyor", listen = "inproc://nanonext") |
| 39 |
res <- socket("respondent", dial = "inproc://nanonext") |
| 40 |
|
| 41 |
survey_time(sur, 1000) |
| 42 |
|
| 43 |
send(sur, "reply to this survey") |
| 44 |
aio <- recv_aio(sur) |
| 45 |
|
| 46 |
recv(res) |
| 47 |
s <- send_aio(res, "replied") |
| 48 |
|
| 49 |
call_aio(aio)$data |
| 50 |
|
| 51 |
close(sur) |
| 52 |
close(res) |
| 53 |
|
| 54 |
} |