467,920 Members | 1,288 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,920 developers. It's quick & easy.

tcp client and sslstream in .net

Hi,


I have developed a VB.NET windows application to read mails from the server.

I am using tcpclient object to read mail from mail server. I am uisng the IMAP and POP protocols for reading the mails. For this i used to send command using write command of ssl stream and read the response using the reader



Dim sslstream As Net.Security.SslStream
Dim reader As StreamReader = Nothing
Dim objTCP As New TcpClient


objTCP.Connect(POPserver, Port)
sslstream = New Net.Security.SslStream(objTCP.GetStream())
reader = New StreamReader(sslstream)

writing data(commands)
Data = strCmd & vbCrLf
SzData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArr ay())
sslstream.Write(SzData, 0, SzData.Length)



reading the response


tmpString = reader.ReadLine()
If tmpString.Substring(0, 4) <> "-ERR" Then
While (tmpString <> "." )
tmpString = reader.ReadLine
End While
End If

The application has to run 24/7 and 365 days with out any stopping.
Problem i am facing i am getting the exceptions while writing and reading
some times application hangs also

Applications is almost done and in the final stage I am stuck with this issue.

I am pasting the exception i am getting while writing and reading

writing exception
Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)


reading exception
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

can anybody please suggest me a solution to fix this

thanks & regards
nevviin
Dec 1 '09 #1
  • viewed: 6854
Share:
1 Reply
If you use .NET, I highly recommend this IMAP component. I found it after I had spent the whole day to try almost available components on the internet. It's better than the others. Other mail components can be found here: POP3 Component, SMTP Component. If you need mail merge (my project needs it), check out this Mail Merge component.
Mar 16 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Jakob Nielsen | last post: by
2 posts views Thread by J Huntley Palmer | last post: by
1 post views Thread by Chris Mullins | last post: by
1 post views Thread by Dubravko Sever | last post: by
3 posts views Thread by Ashish Kaila | last post: by
reply views Thread by Olga | last post: by
3 posts views Thread by =?Utf-8?B?VHJlY2l1cw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.