Hi Semedao,
Can you show me what version of .Net you are using, .Net1.1 or .Net2.0? This
will help us to identify the source code more accurately.
Based on my experience, "Safe handle has been closed" is
ObjectDisposedException, which is normally thrown when an operation is
performed on a disposed object. For example, Socket.BeginConnect method will
check an internal property "CleanUp". If this property returns true, it
means this Socket object is disposed, and the ObjectDisposedException with
error message "Safe handle has been closed" will be thrown.
So you should check if your object is disposed by some other code snippet. A
simple way to check if your object is disposed is openning "Watch Window" in
your VS debugger during exception under debugging, and input
"socketreference.CleanUp" property in it. If the value reports true, it
means the object is disposed.
Finally, if you still can not figure out the root cause, please provide the
detailed stack trace regarding this exception. The stack trace will reveal
some useful information. Thanks.
Btw: how about the "can I use IAsyncResult.IsCompleted Property to know if
Endxxx was already called?" issue now? Have you reviewed my reply to you? Is
it resolved? If you need any help or have anything unclear, please feel free
to tell me, thanks.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support Engineer
within 1 business day is acceptable. Please note that each follow up
response may take approximately 2 business days as the support professional
working with you may need further investigation to reach the most efficient
resolution. The offering is not appropriate for situations that require
urgent, real-time or phone-based interactions or complex project analysis
and dump analysis issues. Issues of this nature are best handled working
with a dedicated Microsoft Support Engineer by contacting Microsoft Customer
Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.