tcp client and sslstream in .net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nevviin
    New Member
    • Dec 2009
    • 1

    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.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
  • jimmyosmand
    New Member
    • Mar 2010
    • 5

    #2
    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.

    Comment

    Working...