// 02_multipart_client — REQ talking through the broker on the frontend port.
//
// Connects to 5559 (the broker's ROUTER frontend in 03_broker_server) rather
// than directly to the REP server. Run alongside 03_broker_server and
// 02_multipart_server (three terminals).
use rustzmq2::prelude::*;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut socket = rustzmq2::ReqSocket::new();
socket
.connect("tcp://127.0.0.1:5559")
.await
.expect("Failed to connect");
socket.send("Hello").await?;
let repl = socket.recv().await?;
println!("{:?}", repl);
socket.send("Hello").await?;
let repl = socket.recv().await?;
println!("{:?}", repl);
Ok(())
}