Hi, I have a simple little program that I'm going to use to access our SMTP
server. The below code works perfectly fine, but my question is if I were
to try to execute the last line (info=streamReader.ReadLine) another time,
the program hangs. Most likely since the SMTP server has no other responses
to post. Is there a way to make the streamreader time out if there is no
other info?
BTW, the only code not posted is ConnectSocket...it just resolves the DNS
and creates the socket..I lifted that from MSDN.....
Dim soc As Socket = ConnectSocket("10.0.100.11", 25)
If soc Is Nothing Then MsgBox("Connection Failed")
Dim info As String
Dim NetworkStream As New NetworkStream(soc)
Dim streamReader As StreamReader = New StreamReader(NetworkStream)
Dim streamWriter As StreamWriter = New StreamWriter(NetworkStream)
streamWriter.AutoFlush = True
'Get the initial command from the host
info = streamReader.ReadLine
'say HELO
streamWriter.WriteLine("HELO")
info = streamReader.ReadLine
info = streamReader.ReadLine ' would like to run again or in a loop to
clear out any buffered info.