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

Is Windows supported? #158

Closed
SpaceMonkeyForever opened this issue Apr 27, 2022 · 8 comments
Closed

Is Windows supported? #158

SpaceMonkeyForever opened this issue Apr 27, 2022 · 8 comments
Labels

Comments

@SpaceMonkeyForever
Copy link

I'm getting the following error on Windows 10:

toml file:

[dependencies]
zeromq = { version = "*", default-features = false, features = ["async-std-runtime", "all-transport"] }

Error:

5 | use async_std::os::unix::net::{UnixListener, UnixStream};
   |                    ^^^^ could not find `unix` in `os`

If I change toml file to:

[dependencies]
zeromq = "0.3.3"

I get:

2 | use tokio::net::{UnixListener, UnixStream};
  |                  ^^^^^^^^^^^^  ^^^^^^^^^^ no `UnixStream` in `net`
  |                  |
  |                  no `UnixListener` in `net`
  |                  help: a similar name exists in the module: `TcpListener`

It seems like it's always expecting a Unix system

@poyea
Copy link
Collaborator

poyea commented Apr 27, 2022

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"] }

@poyea poyea added the question label Apr 27, 2022
@poyea poyea changed the title is Windows supported? Is Windows supported? Apr 27, 2022
@SpaceMonkeyForever
Copy link
Author

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)
    }
}

@poyea
Copy link
Collaborator

poyea commented Apr 27, 2022

Yes, that reconnection feature is missing ATM: #143.

@SpaceMonkeyForever
Copy link
Author

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

@poyea
Copy link
Collaborator

poyea commented Apr 27, 2022

Not sure if this https://github.com/erickt/rust-zmq helps, but it's not a native version.

@SpaceMonkeyForever
Copy link
Author

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.

@poyea
Copy link
Collaborator

poyea commented Apr 27, 2022

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.

@SpaceMonkeyForever
Copy link
Author

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.

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

No branches or pull requests

2 participants