1 vote
closed
Messenger class causes exception on machines without IPv6...

Description

 
I am using the CrossRoad release on 32-bit Windows XP Professional SP2 machines. If I call any method of the Lextm.SharpSnmpLib.Messenger class a TypeInitializationException is thrown for that class. The InnerException property contains a SocketException with the error message "An address incompatible with the requested protocol was used" and error code 10047.

The problem seems to lie in line 27 of Messenger.cs where a static field of type Socket is initialized with an IPv6 UDP Socket instance. I don't have IPv6 installed on my workstations, so I believe that's why it's failing to create an IPv6 Socket. If I install the "Microsoft TCP/IP version 6" protocol for my network connection, then this exception is no longer thrown and everything works fine, however, I would prefer to not have to install IPv6 on all the machines where my application will be used. For now I can use the Manager class which seems to provide equivalent functionality, but most of that class' public methods have been deprecated.

Perhaps lazy initialization would be more appropriate for the udp and udpV6 fields of the Messenger class (that is, don't attempt to create an IPv6 Socket until the first time one is needed)? That way, applications that won't be working with IPv6 anyways won't have to have it installed.

File Attachments


No files are attached


Closed May 1 2009 at 4:53 AM  by lextm

Comments

most recent at top (show oldest at top)
lextm wrote May 28 2009 at 12:20 PM
The patch is now part of #SNMP 2.1. If you meet such socket exceptions, please use 2.1 instead of 2.0.

lextm wrote May 1 2009 at 4:13 AM
Thanks for this detailed report. I just checked in latest changes to resolve this issue following your advice.

Bugs in #SNMP MIB Browser notification panel related this issue are also fixed.

Updating...
© 2006-2010 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2010.1.12.16187