Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

DUN Rasdial disconnecting issue

Posted on 2004-03-23
8
511 Views
Last Modified: 2007-12-19
Hi experts,

I made an application that uses the RasApi to stablish a Dial-up connection with a local ISP. Everything works like a charm except I can't "cancel" the connection.

While it is dialing and authentificating there is a cancel button in my form, if the user click on it I call rashangup to cancel the connection with a loop to check for the "disconnected" error (6).

This works fine, but the connection never gets disconnected.

I have no clue what the problem might be.

Any ideas?

Thanks,

Esopo.
0
Comment
Question by:Esopo
  • 4
  • 3
8 Comments
 
LVL 10

Expert Comment

by:Kavar
ID: 10658040
give me a sec
0
 
LVL 14

Author Comment

by:Esopo
ID: 10662584
Ok, I'll be waiting... ;)
0
 
LVL 14

Author Comment

by:Esopo
ID: 10671443
Ok, I just realized why my code isn't working. It uses RasEnumConnections to get the pending connection but it won't return any. So I can't call RasHangUp on my connection, or can I ?

Of course that's why RasGetConnectStatus return ERROR_INVALID_HANDLE - "The specified port is not connected".



please check out this Q, it has the code I'm using (or if you'd like I can post it here):

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20922613.html


Thanks in advanced,

Esopo

BTW I'm also posting another Q here about this RasEnumConnections issue, this is rather urgent.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 10

Accepted Solution

by:
Kavar earned 250 total points
ID: 10676860
Delphi is about my weakest language, (except for english)

Your problem with RasEnumConnections (I think)
is that  a RASCONN structure needs to be created, then set dwsize to 412

var
  RasConn  : TRasConn;
  bsize    : DWORD;
  Count    :  DWORD;
begin
  RasConn.dwSize := 412;

I think you have another one of these open... That I am working on, Like I was indicating on the other thread,
Just use rashangup on the RASCONN handle that you got from the connection
0
 
LVL 14

Author Comment

by:Esopo
ID: 10682707
Using the handle the Rasdial gave me worked. As I said in the other Q I called RasHangUp with the Handle RasDial returned and seems to be working properly.

I am still wondering why isn't RasEnumConnections returning my pending connection?
Does a conection need to be fully stablish to appear there? It seemed to show the dialing connections in Win98 (not 100% sure but I think so).

Anyway, is there a way to get the handle for the pending connections that RasEnumConnections won't give me?
0
 
LVL 10

Expert Comment

by:Kavar
ID: 10683419
I htink rasenum isn't returning because the handle your passing it is not configured right..??

try initializing all values to (0) except for dwsize, set that to 412

unlikely, but it maybe possible to guess at the address of a given connection if you can scan the heap?!?

(REALLY DANGEROUS STUFF)
0
 
LVL 14

Author Comment

by:Esopo
ID: 10982093
Kavar,
What you posted did not really solve my problem, but hey!, it was a very vague question anyway, thanks for trying. At least I got a new thing to look for when playing with RAS.

Venabili,
Sorry to waist your administrative time, I'll try to see to it that my Q's don't go unatended for so long in the future.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# Error - Add Failed 12 93
Modify a small python script 19 116
object oriented design (python) and documentation tools 2 68
AutoIncrement column based of FK 11 54
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

808 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