Kerja Keras Adalah Energi Kita: Tutorial Simple HTTP proxy in VB Kerja Keras Adalah Energi Kita: Tutorial Simple HTTP proxy in VB »» <$BlogItemTitle$> <body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=21255525&amp;blogName=Kerja+Keras+Adalah+Energi+Kita&amp;publishMode=PUBLISH_MODE_BLOGSPOT&amp;navbarType=SILVER&amp;layoutType=CLASSIC&amp;searchRoot=http%3A%2F%2Fconradsharry.blogspot.com%2Fsearch&amp;blogLocale=en_US&amp;homepageUrl=http%3A%2F%2Fconradsharry.blogspot.com%2F" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe> <div></div>

Kerja Keras Adalah Energi Kita

kerja-keras-adalah-energi-kita

Tutorial Simple HTTP proxy in VB

Exampel source code how to create simple HTTP proxy for sharing Web access between computers in Visual Basic, minimum requirements: VB5 Pro.



Project: Standard EXE
ActiveX Controls/Objects: MSWINSCK.OCX
Controls: cmdStart (CommandButton), txtPort (TextBox), wsTCP (Winsock), _
wsProxy (Winsock), lblStatus (Label), Label1 (Label)

Code:
Option Explicit

Dim s(255) As String
Dim h(255) As String
Dim p(255) As String
Dim i As Integer

Private Sub cmdStart_Click()
If cmdStart.Caption = "Start" Then
wsTCP(0).LocalPort = txtPort
wsTCP(0).Listen
lblStatus = "Running..."
cmdStart.Caption = "Stop"
Else
cmdStart.Caption = "Start"
wsTCP(0).Close
lblStatus = "Stopped"
End If
End Sub
Private Sub wsProxy_Close(Index As Integer)
On Error Resume Next
Unload wsProxy(Index)
wsTCP(Index).SendData p(Index)
End Sub

Private Sub wsProxy_Connect(Index As Integer)
wsProxy(Index).SendData s(Index)
End Sub

Private Sub wsProxy_DataArrival(Index As Integer, ByVal bytesTotal As Long)
wsProxy(Index).GetData h(Index)
Debug.Print "(" & Index & ") " & h(Index)
p(Index) = p(Index) & h(Index)
End Sub

Private Sub wsProxy_Error(Index As Integer, ByVal Number As Integer, Description As String, _
ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, _
ByVal HelpContext As Long, CancelDisplay As Boolean)
Debug.Print "(" & Index & ") Error " & Number & ": " & Description
Unload wsProxy(Index)
End Sub

Private Sub wsTCP_Close(Index As Integer)
Unload wsTCP(Index)
End Sub

Private Sub wsTCP_ConnectionRequest(Index As Integer, ByVal requestID As Long)
i = i + 1
Load wsTCP(i)
Load wsProxy(i)
wsTCP(i).Accept requestID
End Sub

Private Sub wsTCP_DataArrival(Index As Integer, ByVal bytesTotal As Long)
wsTCP(Index).GetData s(Index)
Debug.Print "(" & Index & ") " & s(Index)
Dim strHost As String, iPort As Integer
iPort = 80
If InStr(UCase(s(Index)), "GET ") > 0 Then
strHost = Mid(s(Index), InStr(UCase(s(Index)), "GET ") + 4)
ElseIf InStr(UCase(s(Index)), "PUT ") > 0 Then
strHost = Mid(s(Index), InStr(UCase(s(Index)), "PUT ") + 4)
Else
wsTCP(Index).SendData "Mailformed HTTP request"
Exit Sub
End If
strHost = Left(strHost, InStr(strHost, " ") - 1)
If InStr(strHost, "://") <> 0 Then strHost = Mid(strHost, InStr(strHost, "://") + 3)
If InStr(strHost, ":") <> 0 Then
iPort = Val(Mid(strHost, InStr(strHost, ":") + 1))
strHost = Left(strHost, InStr(strHost, ":") - 1)
End If
If InStr(strHost, "/") > 0 Then strHost = Left(strHost, InStr(strHost, "/") - 1)
With wsProxy(Index)
.RemoteHost = strHost
.RemotePort = iPort
.Connect
End With
End Sub

Private Sub wsTCP_Error(Index As Integer, ByVal Number As Integer, Description As String, _
ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, _
ByVal HelpContext As Long, CancelDisplay As Boolean)
Debug.Print "(" & Index & ") Error " & Number & ": " & Description
Unload wsTCP(Index)
End Sub

Private Sub wsTCP_SendComplete(Index As Integer)
wsTCP(Index).Close
End Sub

'end code
'source: ostrosoft.com

Labels: , ,




 

0 Comments:

Add a comment..

Feeds rssSponsored By



Search

Subscribe feeds via e-mail

Categories

Subscribe feeds rss Recent Entries

Banner links

Advertise Here

Button Badges

Programming Blogs - BlogCatalog Blog Directory
Preview on Feedage: kerja-keras-adalah-energi-kita
Top Computers blogs
Blog directory On our way to 1,000,000 rss feeds - millionrss.com Subscribe in BlogLines!
feeds2read RSS Directory Blog Directory & Search engine
Computers Blogs - Blog Top Sites Directory of Computers/Tech Blogs hit counters
TopOfBlogs DigNow.net
website tracker Subscribe in NewsGator Online
Computers blog search directory
kerja keras adalah energi kita
Increase your back-link numbers and therefore your website's page rank by: 1.Back-links, page rank and keywords ANALYSIS and 2. Back-link rotation exchange rotation system & Google-Bot detection and behavior analysis (by.kerjakeras)
Afsyuhud.BlogSpot.com Add to My Yahoo! Add to Google
Get Chitika eMiniMalls
eXTReMe Tracker
Software Blog

Kerja Keras Adalah Energi Kita pertamina

kerja Keras adalah energi kita, hard work is our energy, pertamina kerja keras, kerja lebih keras adalah energi kita, adalah kita