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

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


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(""), 10161);

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


Best Regards,
Anders Havn
Jamie Powell (Admin)

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

Extra Support Options
Custom Application Development

posted January 27, 2014 5:22 PM


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: 592
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted March 7, 2014 4:47 PM


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