Closed SpaceMonkeyForever closed 2 years ago
We don't support platforms other than Unix for IPC transport at this point. Would this work?
[dependencies]
zeromq = { version = "*", default-features = false, features = ["async-std-runtime", "tcp-transport"] }
That worked for me. Thank you so much! I really wanted to get this to work.
However, I ran into a separate issue. I'm pushing on a PUB socket from Python and I can listen in Rust SUB but when I restart Python PUB, Rust stops receiving data and I have to restart it to re-establish the connection I guess.
I copy pasted the code from stock_client.rs and got rid of async_helpers as the docs suggest:
// mod async_helpers;
use std::convert::TryInto;
use std::env;
use std::error::Error;
use zeromq::{Socket, SocketRecv};
// use async_std::main;
#[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> {
let args: Vec<String> = env::args().collect();
let mut subscription = "";
if args.len() > 1 {
subscription = &args[1];
}
let mut socket = zeromq::SubSocket::new();
socket
.connect("tcp://127.0.0.1:3000")
.await
.expect("Failed to connect");
socket.subscribe(subscription).await?;
loop {
let recv = socket.recv().await?;
let str = String::from_utf8(recv.get(0).unwrap().to_vec())?;
println!("{}", str)
}
}
Yes, that reconnection feature is missing ATM: #143.
I see. I wish this project would get more contributors, I think ZMQ is great. I'm not sure what a good alternative is for easy communication between processes/servers
Not sure if this https://github.com/erickt/rust-zmq helps, but it's not a native version.
I'm still not sure how to get that working on Windows, it needs libzmq and I think I have to build that manually. My prod uses Linux but I develop on Windows.
Yes, I believe you need to build libzmq
: https://github.com/zeromq/libzmq/blob/master/INSTALL and https://github.com/erickt/rust-zmq#windows-build. This may get tricky depending on your Windows setting. I agree that a native, portable version would be beneficial.
I'm not sure why I didn't close this. I was able to get it to run on Windows but I can't remember now what I needed to do.
I'm getting the following error on Windows 10:
toml file:
Error:
If I change toml file to:
I get:
It seems like it's always expecting a Unix system