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.Ss lStream
Dim reader As StreamReader = Nothing
Dim objTCP As New TcpClient
objTCP.Connect( POPserver, Port)
sslstream = New Net.Security.Ss lStream(objTCP. GetStream())
reader = New StreamReader(ss lstream)
writing data(commands)
Data = strCmd & vbCrLf
SzData = System.Text.Enc oding.ASCII.Get Bytes(Data.ToCh arArray())
sslstream.Write (SzData, 0, SzData.Length)
reading the response
tmpString = reader.ReadLine ()
If tmpString.Subst ring(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.Sock ets.SocketExcep tion: An existing connection was forcibly closed by the remote host
at System.Net.Sock ets.Socket.Send (Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sock ets.NetworkStre am.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
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.Ss lStream
Dim reader As StreamReader = Nothing
Dim objTCP As New TcpClient
objTCP.Connect( POPserver, Port)
sslstream = New Net.Security.Ss lStream(objTCP. GetStream())
reader = New StreamReader(ss lstream)
writing data(commands)
Data = strCmd & vbCrLf
SzData = System.Text.Enc oding.ASCII.Get Bytes(Data.ToCh arArray())
sslstream.Write (SzData, 0, SzData.Length)
reading the response
tmpString = reader.ReadLine ()
If tmpString.Subst ring(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.Sock ets.SocketExcep tion: An existing connection was forcibly closed by the remote host
at System.Net.Sock ets.Socket.Send (Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sock ets.NetworkStre am.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
Comment