|
-
May 11th, 2009, 06:49 AM
#1
Thread Starter
Addicted Member
Unable to write data to the transport connection: An established connection was abort
Hi friends,
I am using to read a inbox message from my asp.net code
The code is below. I got one exception every time i run the application.
I give username and password correctly.But i got exception again,
Exception is "Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. "
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim TcpClient As New TcpClient
TcpClient.Connect("pop.gmail.com", 995)
Dim SslStream As System.Net.Security.SslStream = New SslStream(TcpClient.GetStream())
SslStream.AuthenticateAsClient("pop.gmail.com")
Dim sw As System.IO.StreamWriter = New StreamWriter(SslStream)
Dim reader As System.IO.StreamReader = New StreamReader(SslStream)
sw.WriteLine("USER [email protected]")
' sent to server
sw.Flush()
sw.WriteLine("PASS your_gmail_password")
sw.Flush()
' this will retrive your first email
sw.WriteLine("RETR 1")
sw.Flush()
' close the connection
sw.WriteLine("Quit ")
sw.Flush()
Dim str As String = String.Empty
Dim strTemp As String = String.Empty
While strTemp = reader.ReadLine()
If strTemp = "." Then
Exit While
End If
If strTemp.IndexOf("-ERR") <> -1 Then
Exit While
End If
str += strTemp
End While
Response.Write(str)
Response.Write("<BR>" + "Congratulation.. ....!!! You read your first gmail email ")
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
I hope urs reply.
Failing to plan is Planning to fail 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|