473,378 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

help - my proxy server does not get images

hi.
i have set up a proxy server which gets the text content but does not get
the images.
wat additional code i need to rite for this..
also this code works with only simple website that does not store cookies..
so any suggestions on how to work with sites like rediff n yahoo..
plz help on images first.. n later on for the other problem

Public Sub New(ByVal socket As Socket)
Me.clientSocket = socket
End Sub
Public Sub run()
Dim clientmessage As [String] = " "
Dim sURL As [String] = " "
Dim bytes As Integer = readmessage(read, clientSocket, clientmessage)
If bytes = 0 Then
Return
End If
Dim index1 As Integer = clientmessage.IndexOf(" "c)
Dim index2 As Integer = clientmessage.IndexOf(" "c, index1 + 1)
If index1 = -1 Or index2 = -1 Then
Throw New Exception
End If
Console.WriteLine("Connecting to Site: {0}",
clientmessage.Substring(index1 + 1, index2 - index1))
Console.WriteLine("Connection from {0}", clientSocket.RemoteEndPoint)

Dim part1 As String = clientmessage.Substring(index1 + 1, index2 -
index1)
Dim index3 As Integer = part1.IndexOf("/"c, index1 + 8)
Dim index4 As Integer = part1.IndexOf(" "c, index1 + 8)
Dim index5 As Integer = index4 - index3
sURL = part1.Substring(index1 + 4, part1.Length - index5 - 8)

Try
Dim IPHost As IPHostEntry = Dns.Resolve(sURL)
Console.WriteLine("Request resolved: ", IPHost.HostName)
Dim aliases As String() = IPHost.Aliases
Dim address As IPAddress() = IPHost.AddressList
Console.WriteLine(address(0))
Dim sEndpoint As New IPEndPoint(address(0), 80)
Dim IPsocket As New Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)
IPsocket.Connect(sEndpoint)
If IPsocket.Connected Then
Console.WriteLine("Socket connect OK")
End If
Dim [GET] As String = clientmessage
Dim ByteGet As [Byte]() = ASCII.GetBytes([GET])
IPsocket.Send(ByteGet, ByteGet.Length, 0)
Dim rBytes As Int32 = IPsocket.Receive(RecvBytes,
RecvBytes.Length, 0)
Console.WriteLine("Recieved {0}", +rBytes)
'Buffer = RecvBytes;
Dim strRetPage As [String] = Nothing
strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, rBytes)
While rBytes > 0
rBytes = IPsocket.Receive(RecvBytes, RecvBytes.Length, 0)
strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0,
rBytes)
End While
IPsocket.Shutdown(SocketShutdown.Both)
IPsocket.Close()
sendmessage(clientSocket, strRetPage)
Catch exc2 As Exception
Console.WriteLine(exc2.ToString())
End Try
End Sub 'run
Private Function readmessage(ByVal ByteArray() As Byte, ByRef s As
Socket, ByRef clientmessage As [String]) As Integer
Dim bytes As Integer = s.Receive(ByteArray, 1024, 0)
Dim messagefromclient As String = Encoding.ASCII.GetString(ByteArray)
clientmessage = CType(messagefromclient, [String])
Return bytes
End Function 'readmessage
Private Sub sendmessage(ByVal s As Socket, ByVal message As String)
Buffer = New [Byte](message.Length + 1) {}
Dim length As Integer = ASCII.GetBytes(message, 0, message.Length,
Buffer, 0)
s.Send(Buffer, length, 0)
End Sub 'sendmessage

'Entry point which delegates to C-style main Private Function
'Public Overloads Shared Sub Main()
' Main(System.Environment.GetCommandLineArgs())
'End Sub
Overloads Shared Sub Main(ByVal args() As String)
Const port As Integer = 80
Dim tcplistener As New TcpListener(IPAddress.Parse("192.168.0.66"),
port)
Console.WriteLine("Listening on port {0}", +port)
' tcplistener.Stop()
tcplistener.Start()
While True
Dim socket As Socket = tcplistener.AcceptSocket()
Dim webproxy As New WebProxy2(socket)
Dim thread As New Thread(New ThreadStart(AddressOf webproxy.run))
thread.Start()
End While
End Sub 'Main

Sep 14 '05 #1
0 1171

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Phil Powell | last post by:
I created a page that will be doing image resizing and manipulation, which seems to work (using GD library). However, upon returning to the page where the image has been changed, I still see the...
4
by: Fuzzyman | last post by:
In a nutshell - the question I'm asking is, how do I make a socket conenction go via a proxy server ? All our internet traffic has to go through a proxy-server at location 'dav-serv:8080' and I...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
2
by: Ken Varn | last post by:
I have a control that I developed that uses a custom HTTPModule to dynamically render images to a web page using ASP.NET. It works most of the time with one exception. For some reason, Internet...
0
by: Brian | last post by:
I have implemented a new ASP.NET web site and configured SSL on my proxy server (i.e. not the web server). When I navigate from page to page I get the "You are about to leave a secure internet...
0
by: ian | last post by:
Hello, I have a small test.aspx page with an HtmlInputFile class instance and an imagebutton. When I run this on our proxy server and click the save imagebutton I get the "Page cannot be...
0
by: Phadnis | last post by:
hi. i have set up a proxy server which gets the text content but does not get the images. wat additional code i need to rite for this.. also this code works with only simple website that does not...
1
by: Jim Hubbard | last post by:
I want to write a custom web proxy server using VB.Net 2.0 to allow the end user to filter out images or "adult content" or objectionable words and even ads. But, I have a couple of questions...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.