News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
How to trap SslException when using BeginConnect  
by Martin Plante [plantem at xceedsoft dot com]
posted on 2004/05/04

Hello.

I'm testing the behavior of the library when connecting to a server which does not support the same handshake. My application calls BeginConnect with a callback. During connection, an SslException is thrown from "CompatibilityLayer.cs", line #80, as expected. My callback gets called, and within a try/catch I call EndConnect. It does not throw. I would have expected it to throw that same SslException. At this point, the next line tries to access the RemoteEndPoint property, which ends up calling InternalSocket.RemoteEndPoint, which throws an ObjectDisposedException.

My questions:

a) Shouldn't EndConnect have thrown?
b) Else, how to I get any connection errors?

Thank you.

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2004/05/13

EndConnect doesn't throw an exception because the SSL/TLS handshake hasn't begun at the point EndConnect returns.

RemoteEndPoint throws the ObjectDisposedException instead of the expected SslException because it isn't overridden in the SecureSocket class.

Handshake exceptions are usually caught when calling Send, Receive, or another method that's overridden in the SecureSocket class.

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.