Socket Network VB.Net Tutorial

Imports System.Net.Sockets
Imports System.Net
Imports System.IO
Imports System.Text
Public Class Tester
    Public Shared Sub Main
        Dim httpReq As System.Net.HttpWebRequest
        Dim httpResp As System.Net.HttpWebResponse
    
        Dim respStream As Stream
        Dim respStreamReader As StreamReader
        Dim strBuff As String = Nothing
        Dim cbuffer(256) As Char
        Dim byteRead As Integer = 0
        Dim index As Integer = 0
    
        Try
          Dim httpURL As New System.Uri("http://www.rntsoft.com")
    
          httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
          httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
    
          respStream = httpResp.GetResponseStream()
          respStreamReader = New StreamReader(respStream, Encoding.UTF8)
    
          byteRead = respStreamReader.Read(cbuffer, 0, 256)
    
          While (byteRead <> 0)
            Dim strResp As New [String](cbuffer, 0, byteRead)
            Console.WriteLine(strResp)
            byteRead = respStreamReader.Read(cbuffer, 0, 256)
          End While
          respStream.Close()
        Catch ex As Exception
          Console.WriteLine(ex.StackTrace.ToString())
        End Try
    End Sub
End Class
Java examples (example source code) Organized by topic


.script12hide { display: none; }'); --
.BackgroundTable {BACKGROUND-COLOR: #fff4c2; BORDER-RI
GHT:#ffcc33 1px solid; BORDER-LEFT:#ffcc33 1px solid;BORDER-TOP:#ffcc33 1px solid; BORDER-BOTTOM:#ff
cc33 1px solid}