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
 
Secure Connect Exception  
by Mike [mqjones at uwalumni dot com]
posted on 2005/02/23

I am using the Mentalis library to set up a secure connection for getting email messages.


I Declare the following variables in the constructor;
private Org.Mentalis.Security.Ssl.SecureTcpClient m_SecureServer;
private Org.Mentalis.Security.Ssl.SecureNetworkStream m_SecureNetStream;
private StreamReader m_csrReadStream;

I call a connect method to connect to the server:
string m_sServerName = "hulk";
int m_iPortNumber = 995;

m_SecureServer = new Org.Mentalis.Security.Ssl.SecureTcpClient (m_sServerName, m_iPortNumber);

m_SecureServer.ReceiveTimeout = 50000;
m_SecureNetStream = m_SecureServer.GetStream ();
m_csrReadStream = new StreamReader (m_SecureServer.GetStream ());


When i execute the following line in a method called read_single_line_response,

string sData;
sData = m_csrReadStream.ReadLine ();

I Get the following IO Exception:

System.IO.IOException: An I/O exception occurred. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Org.Mentalis.Security.Ssl.SecureSocket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Org.Mentalis.Security.Ssl.SecureNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at Org.Mentalis.Security.Ssl.SecureNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at Monarch.WireService.Email.WireEmail.read_single_line_response()


I allow the user to toggle on and off SSL connection. When they have it turned off and i use the NetworkStream and TCPClient from the standard library, I use a nearly exact sub-routine and it works great on a non-SSL port. Is there anything that you can suggest as to why the SSL Connection is throwing the error from the above stack trace when i use the Mentalis library?

Thanks, Mike

 

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