|
Web Directory
|
Freeware Vaery Shmelev - unofficialFree VB ebookProxy on Visual Basic |
Create standard Visual Basic project. Deploy element Label “this computer’s IP” on the form Connect a new Winsock component to the project for work with the network according to TCP/IP protocol - Winsock component Free Visual Basic ebooksDeploy two Winsock copies on the form. Winsock1 – for the server part and Oflameron for the client part. The server part (Winsock1) receives queries from the Web-browser (for example, Internet Explorer) through the port, for example, 125 and transmits it to the client part. The client part Oflameron (Winsock2) through standard port 80 transmits queries to the real Web-server. VB ebook >>>> Free ebook >>>> Free Visual Basic ebook >>>> Free download >>>> |
||||
|
||||
Private Sub Form_Load() Form1.Visible = True Do ''Switch the server part to port listening ( Listen ) If Winsock1.State <> sckConnected And Winsock1.State <> sckListening Then ''If there is no connection yet and the port cannot be heard Beep Winsock1.Close ''Close the connection Winsock1.LocalPort = 125 ''Port number for listening Winsock1.Listen ''Begin listening port 125 End If DoEvents Loop ''Repeat End Sub Connections processing Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) ''If there is query for connection Winsock1.Close ''Stop listening the port Winsock1.Accept requestID ''Connect the client (browser) according to the number of the query End Sub Winsock1_ConnectionRequest – query for connection |
Announce the variable Dim ToServer As String ''To send the query from the client part of Proxy to Web-server Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) ''Processing of incoming data (queries from Web-browser) Dim ServerData As String ''Announce the variable for the received data ServerData Winsock1.GetData ServerData ''Accept data into the variable ToServer = ServerData ''Copy the query into the variable for sending to the Web-server Oflameron_SendToWebserver ''Send the query to the Web-server End Sub Line “ToServer = ServerData” - is not mandatory, it is worthwhile, if it is necessary to process data writing in the log, filter, search for data in queries, substitute information (for example, change URL in downloaded web-pages for one’s own) etc. The entire VB project of this development stage is in the file vbpt1.zip Free Visual Basic ebook >>>> Free VB ebook >>>> Free ebook >>>> Ebook download >>>> Free VB ebooks For work with real Web-server. Connection to Web-server, sending of queries and data receipt. Announce the variables Dim Webport ''Port number Dim Data As String ''To receive data from Web-server Private Sub Oflameron_SendToWebserver() ''Connect to Web-server Oflameron.Close ''Close the connection Oflameron.RemoteHost = "10.62.182.54" ''Web-server address or its IP address Oflameron.RemotePort = 80 ''Port number. Standard for HTTP Oflameron.Connect ''Connect to Web-server Webport = Oflameron.RemotePort ''Remember the port number (optional line) End Sub Procedure Oflameron_Connect performs actions as soon as the Web-server is connected Private Sub Oflameron_Connect() ''Sent query to Web-server If Oflameron.State <> sckConnected Then Exit Sub ''Check. If there is no connection, abandon the procedure Oflameron.SendData ToServer ''Send the query line to the Web-server End Sub The procedure of data receipt from the Web-server Private Sub Oflameron_DataArrival(ByVal bytesTotal As Long) ''The call will be initiated as soon as some data is received from the Web-server Text1.Text = Oflameron.State If Oflameron.State <> sckClosing Then Oflameron.GetData Data ''It will contain data obtained from the Web-server Winsock1.SendData Data ''Send the obtained data from Web server to Web-browser End If End Sub |
- put port number 125 for the server part of Proxy Change Proxy and port settings in Internet Explorer, if you use IE So that queries were sent to our Proxy LAN adjustment Where - the address of our Proxy (IP-address of your computer) and port 125, which will listen to the server part of your Proxy Upload the page from the Web-server to Internet Explorer website Proxy-server operates –sends queries and received data. Visual Basic ebooks This is a working example of a most elementary Proxy-server in the minimal code configuration. It allows to understand important specifics of network programming, create a working copy of the program.
|
Download Ebook Source Code |
|
|
|