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

Tcp keep alive setting function #155

Open
testforvln opened this issue Apr 6, 2022 · 2 comments · May be fixed by #156
Open

Tcp keep alive setting function #155

testforvln opened this issue Apr 6, 2022 · 2 comments · May be fixed by #156

Comments

@testforvln
Copy link

Hi all, I use this crate on receiving live stock quotes from stock exchanges. When the market daily rests for a while and then restarts trading, I could get no data from the zmq connection established before.
It can be fixed by tcp keep alive settings, but I could not find the related function in this crate. Could you help me with it?

@poyea
Copy link
Collaborator

poyea commented Apr 6, 2022

Hey there! I believe it isn't available as of v0.3.3 - as part of the option. Correct me with an example if I'm wrong. Ideally, we want to support something like this:

let mut options = SocketOptions::default();
// or a "TCP option"
options.tcp_keepalive(TcpKeepalive {
    keepalive: 1,
    count: 5,
    idle: 1,
    interval: 10,
});

let mut socket = zeromq::ReqSocket::with_options(options);
socket
    .connect("tcp://127.0.0.1:8888")
    .await
    .expect("Failed to connect");

@testforvln
Copy link
Author

Yeah, this exmaple of with_options funciton is very helpful. I think it's the ideal way to implement the zmq options settings.

@poyea poyea linked a pull request Apr 19, 2022 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants