Newbie kademlia
question. How to connect to other peers?
#2177
Replies: 2 comments 3 replies
-
Two things:
|
Beta Was this translation helpful? Give feedback.
-
Hi, I have managed to get the code working, now. I'm able to connect to other peers and see other peers in the their I'm trying to refactor my code and instead of creating a seperate method that serves as the loop {
futures::select! {
// handle input from the command line
line = stdin.read_line(&mut buffer).fuse() => handle_command(buffer),
// handle events from the Swarm
event = swarm.next() => handle_event(event.unwrap()),
}
} I'm having trouble figuring out the type of the fn handle_event(event: SwarmEvent<(), EitherError>) {
match event {
SwarmEvent::NewListenAddr { address, .. } => println!("Listening on: {}", address),
_ => {}
}
} I see that In correlation to this, I am a little confused about the difference between |
Beta Was this translation helpful? Give feedback.
-
Hi,
For the past week, I have been trying to write a program that creates four peers, each of which supports the
Kademlia
behavior. I put all of them in one swarm, and then listen on an arbitrary ip address. I want all the four peers connect to one another, once that happens I should be able to see all the peers in each other'skbucket
.However this code always fails to find peers.
I tried to run the
ipfs-kad
example code, but it always fails to find the closest peers, even if I'm supplying it with one of the peers from the boot nodes.I think, I'm missing the code to announce each peer to one another. Can someone please help me? I would like to know how to connect the peers to each other.
Beta Was this translation helpful? Give feedback.
All reactions