473,379 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

tcp client and sslstream in .net


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
Dec 1 '09 #1
1 7602
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

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

Similar topics

by: Jakob Nielsen | last post by:
This is a question about partly .net sslStreams and partly about the certificates it uses. I can't seem to find a more specific group.. and since i am coding in c# :-) I try creating a sslStream...
by: J Huntley Palmer | last post by:
I am having a horrific time integrating uw-imap's c-client for imap support in php. The problem is a whole bunch of "Text relocation remains referenced against symbol" errors during linking....
by: Azrael | last post by:
Hi, I have an SSLStream and i want to resume the SSL-Session for another connection to this server. How can i do this? I haven´t found any clues for it in SSLStream, perhaps Negotiatestream...
by: Chris Mullins | last post by:
We've been using the SSLStream class found in System.Net.Security to build a giant Sockets server that provides TLS encryption at the channel leve. Before .Net 2.0, we used an open-source...
by: Dubravko Sever | last post by:
Hi, I have problem with SSLStream. I'm using it with p12 certificate and it works well when I running my code as console application (manully called). But problem starts when I tryint run it as...
by: Matt Nunnally | last post by:
I'm trying to build a client for a third party application that resides on the server and accepts SSL communication. i'm using this code: tcpClient.Connect(m_IPAddress, m_Port) ...
by: Ashish Kaila | last post by:
I have an asp.net website that my clients use via SSL. I need another http communication within a postback to receive remote data to fulfill my current postback request operation. I have to listen...
by: Olga | last post by:
Hi! I have to make some investigation about possibility to develop IMAP/SSL client. Can somebody help me with the understanding how SSL will work? Now I have the simple example to establish the...
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I'm creating an application that will read emails from GMail, using the System.Net.Sockets.TcpClient and POP protocol. However, I am having a problem with my SslStream. ...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.