For a socket or context using the surveyor protocol in a surveyor/respondent pattern. Set a survey timeout in ms (remains valid for all subsequent surveys). Messages received by the surveyor after the timer has ended are discarded.

survey_time(con, time)

# S3 method for nanoSocket
survey_time(con, time)

# S3 method for nanoContext
survey_time(con, time)

## Arguments

con

a Socket or Context using the 'surveyor' protocol.

time

the survey timeout in ms.

## Value

Invisibly, an integer exit code (zero on success).

## Details

After using this function, to start a new survey, the surveyor must:

• send a message.

• switch to receiving responses.

To respond to a survey, the respondent must:

• send a reply using send_aio before the survey has timed out (a reply can only be sent after receiving a survey).

## Examples

sur <- socket("surveyor", listen = "inproc://nanonext")
res <- socket("respondent", dial = "inproc://nanonext")

survey_time(sur, 1000)
#>  [1] 58 0a 00 00 00 03 00 04 02 00 00 03 05 00 00 00 00 05 55 54 46 2d 38 00 00
#> [26] 00 10 00 00 00 01 00 04 00 09 00 00 00 14 72 65 70 6c 79 20 74 6f 20 74 68
#> [51] 69 73 20 73 75 72 76 65 79
aio <- recv_aio(sur)

recv(res)
#> $raw #> [1] 58 0a 00 00 00 03 00 04 02 00 00 03 05 00 00 00 00 05 55 54 46 2d 38 00 00 #> [26] 00 10 00 00 00 01 00 04 00 09 00 00 00 14 72 65 70 6c 79 20 74 6f 20 74 68 #> [51] 69 73 20 73 75 72 76 65 79 #> #>$data
#> [1] "reply to this survey"
#>
s <- send_aio(res, "replied")

call_aio(aio)\$data
#> [1] "replied"

close(sur)
close(res)