Error 756 "This connection is already being dialed." on subsequent dials when a modem is not responding.


(Possibly related to 12104, but I suspect it isn't)
If a modem does not respond during a dial, the port is not closed when the dialer cleans up. This results in the error 756 "This connection is already being dialed." which will then continue to occur until the program is restarted.
In the RasDialer.RasDialCallback() function, you will find that e.State == RasConnectionState.OpenPort in this scenario. When this.Abort() is subsequently called, it calls RasHelper.Instance.IsConnectionActive(). The first problem is that this function does not consider the connection "active" just because the port is open, and therefore does not attempt to hang it up.
The second problem is in the RasHelper.Instance.HangUp() function itself. It does not correctly handle the return code (ERROR_NO_CONNECTION) when called in this state. it throws an error when instead it should simply set the handle as invalid and continue.
Although the Hangup() function does not report SUCCESS in this case, it does actually close the port, which allows successive dials to be made without invoking the wrath of error 756.
To replicate the problem, attempt to dial through a modem that is physically switched off.
I have attached a patch to handle the scenario.

file attachments

Closed Nov 10, 2010 at 1:17 AM by jeff_winn
Duplicated work item. Reference: #12104.


jeff_winn wrote Nov 9, 2010 at 2:58 PM

This sounds exactly like the bug I just fixed recently when using RasConnectionWatcher to dial a connection when the machine just came out of sleep. Did you try the proposed fix attached to the 12104 work item? We were discussing the bug in a discussion thread instead of the work item, but this sounds exactly like the same problem. I also had to pull out the IsConnectionActive check there as well after I saw the same results you did with the connection not being considered active. I also had to handle the ERROR_NO_CONNECTION return code you just mentioned. It was resolved in changeset 68819.

Check the proposed fix - rev 2.zip on the 12104 work item (you'll have to show all items, it's already closed) and let me know.

wrote Nov 9, 2010 at 2:58 PM

jeff_winn wrote Nov 9, 2010 at 3:19 PM

Here's the link to the discussion I mentioned in my previous post. http://dotras.codeplex.com/Thread/View.aspx?ThreadId=230093

RussellPhillips wrote Nov 10, 2010 at 12:20 AM

I've just tried "fix - rev 3.zip" and it appears to have also fixed the problem.

Looking forward to the final release :)

wrote Nov 10, 2010 at 1:17 AM

wrote Feb 22, 2013 at 12:43 AM

wrote May 16, 2013 at 12:22 PM