Re: Proxy Server Bypass Help
Can you explain what the problem is with your code?
Re: Proxy Server Bypass Help
Re: Proxy Server Bypass Help
The problem is that the only site I can go is Google and not on Facebook. Maybe because of the for loop in the main method or the for loop in the ProxyServer.run :)
Re: Proxy Server Bypass Help
Have you tried going only to the one site and does it work then?
Why do you start 5 threads?
Re: Proxy Server Bypass Help
Yes, but even if i type Welcome to Facebook - Log In, Sign Up or Learn More, the browser only goes to Google..
That for loop is for the multi thread, so that it can accept connections, the 5 is just for testing.. I can't make it while(true) {} :/
Re: Proxy Server Bypass Help
The proxy only accepts Google.com, even if I type Facebook.com . The for loop is for the threading so that it can accept multiple connection, the 5 is only for testing. I can't use while(true).
When I put the oc.run() outside the try catch, it only now allows Facebook.com . :/
Re: Proxy Server Bypass Help
You only need one ServerSocket for all your connections. When you get a connection, create a new thread and pass the socket from the connection to that thread.
Re: Proxy Server Bypass Help
Well, as you can see I only have 1 ServerSocket. :/
Re: Proxy Server Bypass Help
Why do you have more than one accept call for that one server socket?
Re: Proxy Server Bypass Help
Can you explain what your code is supposed to do?
The browsers are set to use your server as a proxy.
The server is started.
A browser tries to connect to a site: httP://somesite.com
The connect is sent to your server
What does your server do now???
Re: Proxy Server Bypass Help
I'm planning to thread or allow the 2 host "Google.com" and "Facebook.com" bypass the proxy. :/ but it turns out that it only allows 1?
Re: Proxy Server Bypass Help
Can you explain what your code is supposed to do?
The browsers are set to use your server as a proxy.
The server is started.
A browser tries to connect to a site: httP://somesite.com
The connect is sent to your server
What does your server do now???
Re: Proxy Server Bypass Help
The browsers are set to use my server as a proxy.
I start the server at port 50005;
Wait for a browser to connect;
When the browser connect and typed any of the sites in the host[], it will allow it or bypass.
The OpenConnection will start and start streaming or reading bytes from that site.
But when the the typed site is not in the host[] it will not allow it.
That's all, all I want is to allow the server to bypass all the sites in the host[] in my proxy. :/
Re: Proxy Server Bypass Help
What parts of your code works? Have you tested any of the parts by themselves to be sure that they work?
Re: Proxy Server Bypass Help
Yes they work, I think the error is that. When the socket of the server was created with the host name Google.com, the next socket of the server which is Facebook.com is not being recognized as a server that is allowed to connect to. I tried to put the oc.run() outside the try catch, and it turns out that it only allows Facebook.com :/
I can't make it that multiple servers are allowed to be bypass from the proxy.
Re: Proxy Server Bypass Help
Where does your code test what the site is that the browser is trying to connect to?
It seems that it always tries to connect to the first site in the host array.
Why call oc.run() which blocks the loop instead of creating a thread and starting it?
Re: Proxy Server Bypass Help
Hmm, i'm just debugging and turns that when i put the "www.google.com" as host in the Socket serverSocket = new Socket("www.google.com", 80), it allows to bypass the site Google. That's why i tried to loop it so that all the sites in the host[] will make a socket for that site. But it turns out that it only allows that it blocks the loop.
Can you think of a code that will return the inputted site by the user in the browser into a string? Like:
String inputtedHost = clientSocket.getInetAddress().getHostName() ? I like to store the value that the user inputted in the browser, like "www.google.com"
Re: Proxy Server Bypass Help
Print out everything about the socket connection and what you read from it to see what URL the user entered in the browser. The original URL must be there somewhere.
Re: Proxy Server Bypass Help
I'll try, but please help me try bypass the host in the host[], using only streams and socket. thank you