|
From: mauro on 25 Jun 2008 08:32 Hi all, I have developed a simple software for a WM5.0 device that makes the following operations: - creates a GPRS and VPN connections through the DMProcessConfigXML API. - opens the VPN connection through the OpenNETCF ConnectionManager. - launch the TelnetCE software using the System.Diagnostics.Process class e using the WaitForExit method. - when the TelnetCE is closed, my software closes all connections through the ConnectionManager Disconnect method. Since the connection manager doesn't close all the opened connections, the software must use the RasHangUp API. The problem is that the device becomes unusable when the first RasHangUp is called on the first opened connection (got through the RasEnumConnections API). Switching off and switching on the device, the RasHangUp API seems to continue its work but the system connections are unusable anyway. Only after a softreset the connections become usable. If my software launch another application instead of TelnetCE, the problem doesn't occur. Can TelnetCE lock the connection even if it is closed? How can I solve this problem? Thanks in advance mauro PS: My disconnect methods private static void disconnect() { if (_connectionManager != null) _connectionManager.Disconnect(); _connectionManager = null; Thread.Sleep(5000); hangUpExistingConnection(); } private static void hangUpExistingConnection() { int conns = 0; RASCONN[] ras = new RASCONN[256]; ras.Initialize(); ras[0].dwSize = Marshal.SizeOf(typeof(RASCONN)); int lr = ras[0].dwSize * ras.Length; int ret = RasEnumConnections(ras, ref lr, ref conns); for (int i = 0; i < conns; i++) { try { RasHangUp(ras[i].hrasconn); // Execution stops here. Thread.Sleep(3000); } catch (Exception ex) { showErrorMessage(ex); // No errors occured } } }
|
Pages: 1 Prev: Almost always connected scenario Next: Environment.StackTrace Functionality |