Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rzmq Client error with Python Server #53

Open
chintanp opened this issue May 7, 2020 · 0 comments
Open

rzmq Client error with Python Server #53

chintanp opened this issue May 7, 2020 · 0 comments

Comments

@chintanp
Copy link

chintanp commented May 7, 2020

I am trying to run the Request-reply example with a Python server and rzmq client.

The Python code I use is as in the zmq docs: http://zguide.zeromq.org/py:hwserver

The R code I am using is as in the docs, modified to send "Hello"

#!/usr/bin/env Rscript
library(rzmq)

remote.exec <- function(socket, fun, ...) {
  send.socket(socket, data = list(fun = fun, args = list(...)))
  receive.socket(socket)
}

substitute(expr)
context = init.context()
socket = init.socket(context, "ZMQ_REQ")
connect.socket(socket, "tcp://localhost:5555")

send.socket(socket, "Hello")
receive.socket(socket)

I see the server printing this:

Received request: b'B\n\x03\x00\x00\x00\x03\x06\x03\x00\x00\x05\x03\x00\x06\x00\x00\x00CP1252\x10\x00\x00\x00\x01\x00\x00\x00\t\x00\x04\x00\x05\x00\x00\x00Hello'

instead it should be:

Received request: b'Hello'

I tried running the R code as Rscript from command line, as well as from RStudio with same result. The client side (R) errors with following message:

expr
Error in unserialize(ans) : unknown input format
Calls: receive.socket -> unserialize
Execution halted

Any steps to debug this would be helpful. I am on Windows 10. I am running the Python server from WSL and the R code from RStudio and RStudio terminal. R version 3.6.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant