Giter Site home page Giter Site logo

Comments (7)

aditya172926 avatar aditya172926 commented on May 28, 2024

I am not able to reproduce the error. The ping example works fine for me.
Doesn't look like a crate bug.

My system config:
rust version: 1.74.1
libp2p: 0.52

from rust-libp2p.

dariusc93 avatar dariusc93 commented on May 28, 2024

Could you provide any code? The ping example works fine, but it looks like you may have altered the code. Also, if you are running the code twice on the same machine, make sure the port number is different for each since it would have already been assigned to one address (in this case "65332" is assigned on one node, so it cannot be used on the second node).

from rust-libp2p.

thomaseizinger avatar thomaseizinger commented on May 28, 2024

Running target\debug\p2pRecipe.exe 'C:/Program Files/Git/ip4/127.0.0.1/tcp/65332'Error: InvalidMultiaddr

This log suggests that the path to the program is also passed as an argument which obviously cannot be parsed as a multiaddress.

from rust-libp2p.

varun-doshi avatar varun-doshi commented on May 28, 2024

Here is the code:

`
use futures::prelude::*;
use libp2p::{noise, ping, swarm::SwarmEvent, tcp, yamux, Multiaddr};
use std::{error::Error, time::Duration};
use tracing_subscriber::EnvFilter;

#[tokio::main]
async fn main() -> Result<(), Box> {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();

let mut swarm = libp2p::SwarmBuilder::with_new_identity()
    .with_tokio()
    .with_tcp(
        tcp::Config::default(),
        noise::Config::new,
        yamux::Config::default,
    )?
    .with_behaviour(|_| ping::Behaviour::default())?
    .with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::from_secs(u64::MAX)))
    .build();

swarm.listen_on("/ip4/0.0.0.0/tcp/0".parse()?)?;

// Dial the peer identified by the multi-address given as the second
// command-line argument, if any.
if let Some(addr) = std::env::args().nth(1) {
    let remote: Multiaddr = addr.parse()?;
    println!("The input:{:?}", std::env::args().nth(1));
    swarm.dial(remote)?;
    println!("Dialed {addr}")
}

loop {
    match swarm.select_next_some().await {
        SwarmEvent::NewListenAddr { address, .. } => println!("Listening on {address:?}"),
        SwarmEvent::Behaviour(event) => println!("{event:?}"),
        _ => {}
    }
}

}
`

On further trying to debug, I got this error:

I was trying the debug(just added a few println statements) and now on running the second peer this is what pops up

error: linking with link.exe failed: exit code: 1104

note: LINK : fatal error LNK1104: cannot open file 'D:\VSCode Rust\p2pRecipe\target\debug\deps\p2pRecipe.exe'

from rust-libp2p.

thomaseizinger avatar thomaseizinger commented on May 28, 2024

I don't have a windows machine so I can't reproduce this. Can you use WSL instead?

from rust-libp2p.

aditya172926 avatar aditya172926 commented on May 28, 2024

Here is the code:

` use futures::prelude::*; use libp2p::{noise, ping, swarm::SwarmEvent, tcp, yamux, Multiaddr}; use std::{error::Error, time::Duration}; use tracing_subscriber::EnvFilter;

#[tokio::main] async fn main() -> Result<(), Box> { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) .try_init();

let mut swarm = libp2p::SwarmBuilder::with_new_identity()
    .with_tokio()
    .with_tcp(
        tcp::Config::default(),
        noise::Config::new,
        yamux::Config::default,
    )?
    .with_behaviour(|_| ping::Behaviour::default())?
    .with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::from_secs(u64::MAX)))
    .build();

swarm.listen_on("/ip4/0.0.0.0/tcp/0".parse()?)?;

// Dial the peer identified by the multi-address given as the second
// command-line argument, if any.
if let Some(addr) = std::env::args().nth(1) {
    let remote: Multiaddr = addr.parse()?;
    println!("The input:{:?}", std::env::args().nth(1));
    swarm.dial(remote)?;
    println!("Dialed {addr}")
}

loop {
    match swarm.select_next_some().await {
        SwarmEvent::NewListenAddr { address, .. } => println!("Listening on {address:?}"),
        SwarmEvent::Behaviour(event) => println!("{event:?}"),
        _ => {}
    }
}

} `

On further trying to debug, I got this error:

I was trying the debug(just added a few println statements) and now on running the second peer this is what pops up

error: linking with link.exe failed: exit code: 1104

note: LINK : fatal error LNK1104: cannot open file 'D:\VSCode Rust\p2pRecipe\target\debug\deps\p2pRecipe.exe'

Tried this on a Windows OS setup.
Still not able to reproduce the error. The code works fine, just correcting the return type of the main function
async fn main() -> Result<(), Box<dyn Error>> {...} like it is in the example.

from rust-libp2p.

aditya172926 avatar aditya172926 commented on May 28, 2024

Link error looks like a microsoft linker is failing to open the .exe file.
This points to the improper, outdated or no installation of Microsoft Windows SDK.

Try upgrading your downloads from MS Visual studio. @varun-doshi

from rust-libp2p.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.