Public tcp As New TcpClient
Public netstream As NetworkStream
Public tcpthread As Thread
Public Sub Connetti()
tcp.Connect("mail.tin.it", 25)
netstream = tcp.GetStream
tcpthread = New Thread(AddressOf Leggo)
tcpthread.Start()
End Sub
Public Sub Leggo()
While True
Try
Dim bytes As Byte()
netstream.Read(bytes, 0, 100)
Dim testo As String = Encoding.ASCII.GetString(bytes)
eLog.Text += testo & vbCrLf
Catch e As Exception
End Try
End While
End Sub
Public Sub Scrivo(ByVal testo As String)
Try
eLog.Text += eSend.Text & vbCrLf
Dim stringa As Byte() = Encoding.ASCII.GetBytes(testo)
netstream.Write(stringa, 0, stringa.Length)
Catch e As Exception
End Try
End Sub