This project has moved. For the latest updates, please go here.
1
Vote

Messenger.Get (Compact Framework)

description

Can you provide some advice on how to get over the issue of trying to use:

Messenger.Get to query an SNMP device using the compact framework version of #SNMP.

When the device is connected this works fine. Then if subsequently the device gets disconnected the Messenger.Get function call hangs indefinitely.

I have looked at the source code and the following is apparent:
// Whatever you change, try to keep the Send and the Receive close to each other.
            udpSocket.SendTo(bytes, receiver);
            #if !(CF)
            udpSocket.ReceiveTimeout = timeout;
            #endif
            int count;
            try
            {
                count = udpSocket.Receive(reply, 0, bufSize, SocketFlags.None);
            }
            catch (SocketException ex)
            {
                // FIXME: If you use a Mono build without the fix for this issue (https://bugzilla.novell.com/show_bug.cgi?id=599488), please uncomment this code.
                /*
                if (SnmpMessageExtension.IsRunningOnMono && ex.ErrorCode == 10035)
                {
                    throw TimeoutException.Create(receiver.Address, timeout);
                }
                // */

                if (ex.ErrorCode == WSAETIMEDOUT)
                {
                    throw TimeoutException.Create(receiver.Address, timeout);
                }

                throw;
            }
Am I correct in thinking that there is no receive timeout set using the Compact Framework and hence the call never returns as there is no longer a connected socket.

Can you suggest a way to get around this issue please?

comments