Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Is there a method to obtain a peer port. (Q&A) #1152

Open
bichovis opened this issue Mar 19, 2019 · 0 comments
Open

Is there a method to obtain a peer port. (Q&A) #1152

bichovis opened this issue Mar 19, 2019 · 0 comments

Comments

@bichovis
Copy link

pub fn print_connected_nodes(&self, service: &Service) {
    println!("Node count: {}", self.nodes.len());
    for (id, node) in &self.nodes {
        let ip = service.get_peer_ip_addr(node).unwrap();
        let status = if service.is_connected(node) {
            "Connected   "
        } else {
            "Disconnected"
        };

        println!("[{} - {}] {} {:?}", id, ip, status, node);
    }

    println!();
}

On the examples I've added the following line to obtain a peer IP
let ip = sesion.get_peer_ip_addr(node).unwrap();

This method gives the IP but I can't find how to obtain the port.
Is there any method that returns the peer port?

Thanks.

@bichovis bichovis changed the title Is there a method to obtain a peer port. Is there a method to obtain a peer port. (Q&A) Mar 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant