1 2 3 | Imports System.Net Imports System.Net.Sockets Imports System.Text |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | Dim soc As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Try soc.Bind(New IPEndPoint(IPAddress.Parse("127.0.0.1"), 4040)) soc.Listen(10) Me.Text = "Web Server Started ..." While True Dim client As Socket = soc.Accept Dim sb As New System.Text.StringBuilder Dim html As String = "<html><head><title>Web Server Test</title></head><body><h1>Web Server Hello wolrd!</h1></body></html>" Dim htmlHeader As String = _ "HTTP/1.0 200 OK" & ControlChars.CrLf & _ "Server: WebServer 1.0" & ControlChars.CrLf & _ "Content-Length: " & html.Length & ControlChars.CrLf & _ "Content-Type: text/html" & _ ControlChars.CrLf & ControlChars.CrLf Dim headerByte() As Byte = Encoding.ASCII.GetBytes(htmlHeader) client.Send(headerByte, headerByte.Length, SocketFlags.None) Dim htmlByte() As Byte = Encoding.ASCII.GetBytes(html) client.Send(htmlByte, 0, htmlByte.Length, SocketFlags.None) End While Catch ex As Exception MsgBox(ex.Message) End Try |
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :