Imports System.Net
Imports System.IO
Imports System.Text
Public Class Tester
Public Shared Sub Main
Try
Dim myWebRequest As WebRequest = WebRequest.Create("http://www.java2java.com")
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()
Dim myStream As Stream = myWebResponse.GetResponseStream()
Dim mybyte(1024) As Byte
Dim intreadl As Integer = 0
Do
intreadl = myStream.Read(mybyte, 0, 1024)
Console.WriteLine(Encoding.UTF8.GetString(mybyte, 0, 1024))
Loop While intreadl > 0
myStream.Close()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
|