Login  
Search All Forums
Dart Home | PowerSNMP for .NET | Custom Development Reply | PowerSNMP for .NET Topics | Forums   
AuthorForum: PowerSNMP for .NET
Topic: SocketException when using 127.0.0.1
andershavn

From: Denmark
Posts: 16
Member Since: 01/07/14
posted January 27, 2014 8:11 AM

Hi,

I'm testing with two snmp agents on the same machine. I get a SocketException in this line when trying to send a SetMessage from one agent to the other:
ResponseMessage responseMessage = snmpSocket.GetResponse(sendMessage, _masterAgentEndPoint);

The exception is "The requested address is not valid in its context" and has errorcode 10049.

The _masterAgentEndPoint defined like this:
_masterAgentEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 10161);

It works fine when I replace "127.0.0.1" with ip address of the machine. Why does your code throw an exception when sending to localhost("127.0.0.1")?

Thanks.

Best Regards,
Anders Havn
Jamie Powell (Admin)

From: Rome, NY USA
Posts: 380
Member Since: 03/13/07

Extra Support Options
Custom Application Development

posted January 27, 2014 5:22 PM

Hello,

This exception is thrown from the .NET Socket class; it usually indicates that you're attempting to send to an IPv4 address from an IPv6 address or vice versa. The IP address that the SnmpSocket binds to can be specified in the Start() overload, or the SnmpSocket constructor overload.

If that does not resolve your issue, please send an email into support@dart.com for further assistance, as we'll need to look at what IPs you're binding to, etc.
Nick B (Admin)

From: Utica, NY USA
Posts: 576
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted March 7, 2014 4:47 PM

Hello,

We've looked into this further, and this can also be caused by binding to a local IP address for which 127.0.0.1 is not within its context (for example, by binding to your network card's IP address). Using 127.0.0.1 or IpAddress.Any (0.0.0.0) for the local endpoint (specified in Manager.Start() or the SnmpSocket constructor) will allow you to hit 127.0.0.1.
Reply | PowerSNMP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX