?
Solved

Windows 2003 --  RasHangUp blocks for several seconds before returning, and handle count keeps climbing?

Posted on 2007-08-07
6
Medium Priority
?
557 Views
Last Modified: 2012-06-21
I am using RAS to create and disconnect VPN connections.  I can establish the connection without any problems and transfer data across it.  However, I am experiencing two issues:

1.  RasDial blocks for about 5 seconds before returning.
2.  According to Task Manager, the program's handle count is steadily increasing, even though I am careful to give RAS enough time to release the handle.


Here is my hangup code, :

int hangup(HRASCONN* vpnConn)
   {

   DWORD RASDialStatus = -1;
   RASCONNSTATUS vpnConnStatus;

   memset ((void*) &vpnConnStatus, 0, sizeof(RASCONNSTATUS));
   vpnConnStatus.dwSize = sizeof(RASCONNSTATUS);

   RASDialStatus = RasHangUp(*vpnConn);
   

   if (!RASDialStatus)
      {
      while (RASDialStatus != ERROR_INVALID_HANDLE)
         {
         RASDialStatus = RasGetConnectStatus (*vpnConn, &vpnConnStatus);
         Sleep(0);
         }
      }

   /* Error handling stuff goes here */

   }


I thought at first that the while() loop was causing the delay.  However, when I step through the code, RasHangup() blocks for about 5 seconds before it returns 0.  The while loop runs just once before the RasGetConnectStatus returns ERROR_INVALID_HANDLE.

Does anyone know what might be causing RasHangup to take so long to return?  Could it be something in the way that I am initializing the connection properties when I call RasDial?

Thanks!
0
Comment
Question by:TomPro
  • 4
  • 2
6 Comments
 
LVL 22

Expert Comment

by:grg99
ID: 19648782
I would not worry about the delay.   If it's troublesome you could always run that  code in a separate thread.

0
 
LVL 1

Author Comment

by:TomPro
ID: 19650444
Unfortunately, the delay *is* an issue.  The program depends on retrieving data over VPN connections as quickly as possible.  It's important to have the user wait as little as possible as the program makes up to 20 consecutive VPN connections to locate information.  

Even cutting the delay down from 5 seconds to 3 seconds per connection could make considerable difference for our end users.
0
 
LVL 1

Author Comment

by:TomPro
ID: 19664457
Does anyone have any additional insight on this issue?

Thanks!
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
LVL 22

Expert Comment

by:grg99
ID: 19664640
You could spin off each connection as a separate thread, unless there is some concurrency issue.   With a little luck you could have everything happening in parallel instead of serially.



0
 
LVL 1

Author Comment

by:TomPro
ID: 19720222
grg99, this approach is a good idea except for one problem:  the IP address that I access once I open the VPN is the same for each VPN connection.  

In other words, if I have VPN firewalls with external addresses a.a.a.a, b.b.b.b, and c.c.c.c, once I connect to each, my program interacts with a system at address e.e.e.e behind the VPN.

Also, I am still searching for an answer to why I am seeing an increase in handle count each time the posted code runs.

Thanks guys!
0
 
LVL 1

Accepted Solution

by:
TomPro earned 0 total points
ID: 22130509
Update regarding this issue -- I have since switched to a different network connection strategy that avoids VPN, so I was unable to find a true fix for this problem.
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use NetMotion Mobility on your PC and plan to upgrade to Windows 10, it may not work unless you take these steps.
How to set-up an On Demand, IPSec, Site to SIte, VPN from a Draytek Vigor Router to a Cyberoam UTM Appliance. A concise guide to the settings required on both devices
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question