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
 
Cannot access a disposed object named "Org.Mentalis.Security.Ssl.Shared.SocketController  
by Kelly Chou [kellytlim at hotmail dot com]
posted on 2005/05/25

Hi

I get this error when I'm trying to send using the secure socket. Any ideas? Here is a code snippet:
Dim options As Ssl.SecurityOptions
Dim socket As Ssl.SecureSocket

options = New Ssl.SecurityOptions(Ssl.SecureProtocol.Ssl3, Nothing, Ssl.ConnectionEnd.Client)
socket = New Ssl.SecureSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, options)
socket.Connect(New IPEndPoint(Dns.Resolve(_ProcessorServer).AddressList(0), _Port))

Dim data As Byte() = System.Text.Encoding.ASCII.GetBytes(sw.ToString.Trim)
socket.Send(data, 0, data.Length, SocketFlags.None)

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2005/05/30

This probably happens because there was an error during the handshake phase.

When socket.Connect successfully returns, this doesn't mean that the SSL handshake has been successfully completed. If for some reason the handshake fails, the next call to the socket object will throw an exception (in your case, socket.Send). The reason you're getting a relatively obscure exception is because you're working on a LAN (I presume). Sometimes, the handshake messages are sent so fast that the handshake is actually complete before the call to socket.Send. In this case, the internal socket variables are already cleaned up when you call socket.Send, resulting in the ObjectDisposedException.

The SSL handshake typically fails because the server doesn't have an RSA certificate installed and because our security library doesn't support non-RSA cipher suites.

 

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