SharpLink icon indicating copy to clipboard operation
SharpLink copied to clipboard

Unspecified addresses exception trying to reproduce audio

Open jfebrerc opened this issue 3 years ago • 0 comments

Whenever I try to use the "GetTracksAsync" method, I'm getting this exception: "Exception: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter 'hostName') (0.0.0.0:2333)".

My lavalink server is setup in a rpi and I'm trying to run the code from my local computer.

This is my code in the Program.cs file

    LavalinkManager lavalinkManager = new LavalinkManager(client, new LavalinkManagerConfig
    {
        RESTHost = "192.168.0.198",
        RESTPort = 2333,
        WebSocketHost = "192.168.0.198",
        WebSocketPort = 2333,
        Authorization = "youshallnotpass",
        TotalShards = 1
    });
    [....]
    client.ShardReady += async(socketManager) =>
    {
        await lavalinkManager.StartAsync();
    };

And I'm using the sample code to run the audio:

LavalinkPlayer player = _lavalinkManager.GetPlayer(Context.Guild.Id) ?? await _lavalinkManager.JoinAsync((Context.User as IGuildUser)?.VoiceChannel);

// Now that we have a player we can go ahead and grab a track and play it
LoadTracksResponse response = await _lavalinkManager.GetTracksAsync($"ytsearch:{query}");
// Gets the first track from the response
LavalinkTrack track = response.Tracks.First();
await player.PlayAsync(track);

This is my application.yml config file and my Lavalink server output.

I tried changing the address from the application.yml file to "192.168.0.198"(rpi's ip), leaving it at "0.0.0.0" and now using the "127.0.0.1" but I'm not sure why I'm getting the exception.

jfebrerc avatar Oct 15 '22 18:10 jfebrerc