an unknown duration it just accepts connections and hangs. When this
happens I telnet into the server and it connects fine but also hangs.
Sub ListenToServer()
Dim LISTENING As Boolean
Dim localhostAddress As IPAddress =
ipAddress.Parse(ipAddress.ToString)
Dim oFile As System.IO.File
Dim oWrite As New System.IO.StreamWriter("c:/spam.txt", True)
Dim tcpList As New TcpListener(localhostAddress, 25)
LISTENING = True
Do While LISTENING
tcpList.Start()
Dim tcpCli As TcpClient = tcpList.AcceptTcpClient()
Dim ns As NetworkStream = tcpCli.GetStream
Dim sr As New StreamReader(ns)
Dim sw As New StreamWriter(ns)
sw.WriteLine("220 iMail SMTP server ready")
sw.Flush()
Dim receivedData As String = sr.ReadLine()
If InStr(LCase(receivedData), "ehlo") = 1 Or
InStr(LCase(receivedData), "helo") = 1 Then
sw.WriteLine("250 iMail Hello [71.105.78.90]")
Dim sender_email As String = sr.ReadLine()
sender_email = Trim(Replace(LCase(sender_email), "mail
from:", ""))
sw.WriteLine("250 " + sender_email + "....Sender OK")
sw.Flush()
Dim dest_email As String = sr.ReadLine()
dest_email = Trim(Replace(LCase(dest_email), "rcpt
to:", ""))
dest_email = Replace(dest_email, "<", "")
dest_email = Replace(dest_email, ">", "")
'MsgBox(dest_email)
sw.WriteLine("250 " + dest_email)
sw.Flush()
receivedData = sr.ReadLine()
sw.WriteLine("354 Start mail input; end with
<CRLF>.<CRLF>")
sw.Flush()
Dim c As Integer = 0
Do While receivedData <"." And Len(receivedData)
0receivedData = sr.ReadLine()
sw.Flush()
Loop
sw.WriteLine("250 Queued mail for delivery")
sw.Flush()
End If
sr.Close()
sw.Close()
ns.Close()
tcpCli.Close()
Loop
tcpList.Stop()
End Sub
Any help is appreciated. TIA