RE: Is synchronous RasDial() thread-safe?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi, Whitney,
Thanks for your response!

Yes, your application accessed the modem with RasDial(), but the modem
should have a connection number limit. Most hardware devices have a limit
to the number of connections allowed to the device. From your code, I see
the Disconnect function was not used to close the connection. No matter how
many clients with different IP addresses, each one should close its
connection when it is no longer usable.

Let me answer your three questions:
1) Q: Why does the second RasDial() take so long to return?
A: If the device only allowed one connection, the second RasDial()
will connect only after the first connection is closed. There will be a
waiting time for the new connection when the former connection hasn't been
released. To some devices, even if you explicitly used disconnect method
in clients, the server needs time to finish the closure.

2) Q: Why do we sometimes get a SocketException after the second RasDial()?
A: Sometimes the waiting time is too long to access the device, so your
application displays the WSAECONNABORTED error which means the virtual
circuit was aborted due to a timeout or other failure. The cause of the
long wait time is most likely simultaneous calls to access the device.
Also, sometimes the device port will be blocked and can't accept any
connections.

3) Q: Why do the SocketExceptions go away when we surround our RasDial()
call with a lock(Monitor::Enter()/Exit())?
A: When you used synchronous statements, you ensured the threads
invoked the connections to the remote modem in sequence. In this case, the
waiting time for the last closure existed. So you found a longer wait
time instead of SocketExceptions.

As to the first connection, there was no wait, so you got a quick response.

If you have any other concerns, please feel free to let me know. It's my
pleasure to be of assistance.
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.

This and other support options are available here:

BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others:
https://partner.microsoft.com/US/technicalsupport/supportoverview/

If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
=====================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • Re: Using Cingular 2125 as USB modem with Laptop...
    ... As the initialization string when you configure the HTC Modem driver, ... Disconnect the phone from the USB cable and power it down. ... Connection Settings and uncheck the box "Open ActiveSync whem my device ... support was very unhelpful on this subject. ...
    (alt.cellular.cingular)
  • RE: Firewall Client installed - cannot use Dialup via modem?
    ... The modem was connected to the client computer directly or connect to the ... Do you use the "new connection ... Microsoft Online Partner Support ...
    (microsoft.public.isa)
  • Re: Very Basic Router Question
    ... and connected the PC directly to the cable modem. ... I then put the router back in the loop and connection remained stable ... ipconfig /release ... What I do is specifically request to talk to a different support ...
    (alt.internet.wireless)
  • Re: Tech Question on Networks
    ... support bods might be able to assist as they can check your modem ... and try your connection with the PC directly connected to your Cable ... support groups before so i know of their simultaneous downloads etc ...
    (uk.people.silversurfers)
  • Re: Which One? CE 5.0 or 6.0 or WIN Mobile?!!!
    ... using TAPI interface? ... Did you develop any driver for the modem? ... then we use AT commands in our application to make connection ... support and development for Windows CE ...
    (microsoft.public.windowsce.platbuilder)