Quantcast
Channel: C# Based Open Source SNMP Library for .NET and Mono
Viewing all articles
Browse latest Browse all 576

Created Unassigned: DiscoverAsync returns "0.0.0.0" as agent.address [7295]

$
0
0
I´m trying to use DiscoverAsync method but I´m having some troubles. This is my code:

```
private void button1_Click(object sender, EventArgs e)
{
asyncMethod();
}
private async void asyncMethod()
{
Discoverer disc = new Discoverer();
disc.AgentFound += DiscovererFound;
await disc.DiscoverAsync(VersionCode.V1, new IPEndPoint(new IPAddress(new byte[] { 192,168,1,255}), 161), new OctetString("public"), 6000);
}
private void DiscovererFound(object sender, AgentFoundEventArgs e)
{
Console.WriteLine(e.Agent + ":" + e.Variable.Data);
}
```

And this is the output:

```
0.0.0.0:0:RICOH Aficio MP C300SR 2.09 / RICOH Network Printer C model / RICOH Network Scanner C model
0.0.0.0:0:RICOH Aficio MP 301 1.06 / RICOH Network Printer C model / RICOH Network Scanner C model / RICOH Network Facsimile C model
0.0.0.0:0:RICOH Aficio MP 2851 1.01 / RICOH Network Printer C model / RICOH Network Scanner C model
```
As you can see, It´s returning "0.0.0.0:0" as agent endpoint, but I think my code is correct because it discovers the id of the three printers I have connected. For the purpose of my program I need the IP addresses. I would thank you any help in this.

Regards!

PD: I´m using "192.168.1.255" because it throws me a socket exception with "IPAddress.Broadcast" or "255.255.255.255".

Viewing all articles
Browse latest Browse all 576

Trending Articles