RE: Is synchronous RasDial() thread-safe?
- From: changliw@xxxxxxxxxxxxxxxxxxxx (Charles Wang)
- Date: Wed, 07 Jun 2006 02:40:22 GMT
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.
.
- References:
- RE: Is synchronous RasDial() thread-safe?
- From: Charles Wang
- RE: Is synchronous RasDial() thread-safe?
- From: Charles Wang
- RE: Is synchronous RasDial() thread-safe?
- Prev by Date: Re: RAS API on disconnect event?
- Next by Date: Re: Socket communication on multihomed box
- Previous by thread: RE: Is synchronous RasDial() thread-safe?
- Next by thread: RE: Is synchronous RasDial() thread-safe?
- Index(es):
Relevant Pages
|