Solved

DUN Rasdial disconnecting issue

Posted on 2004-03-23
8
483 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now