This project has moved and is read-only. For the latest updates, please go here.

Messenger.Get (Compact Framework)


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;
            int count;
                count = udpSocket.Receive(reply, 0, bufSize, SocketFlags.None);
            catch (SocketException ex)
                // FIXME: If you use a Mono build without the fix for this issue (, 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);

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?