tags:

views:

50

answers:

2

Hi All,

Want to get a Google home page through proxy using JAVA & i must use only sockets in java NOT URL class. I need to authenticate with some username & password to proxy. How to do this????(I am not allowed to use URL only socket can be used)

Please reply, Thank's For Reading!!!

A: 

At this point you didn't start to write code yet, so I can help in give you some idea of the problem.

URL class gives (apart from other things) an abstraction above protocol.

You know, when you connect to a server you have a connection (layer 4 - iso) and it's like a phone connection. You are responsible for what you send and receive (the words used in conversation).

When you talk about HTTP you are talking about a definite protocol of words, values and format used to communicate over that connection.

So if you use URL it's likely to help you with that low level stuff.

Your assignment is to retrieve a page from Google, it is, to do a successfull HTTP request to ask for a page. And you must do it with sockets, it is, the objets Java provide for tcp socket connection (again, layer 4 of the good old iso model). So you'll have to use it to establish connection and to do what HTTP protocol says you have to do in order to retrieve a page.

So... start looking for documentation about socket programming in Java, about HTTP protocol (in special GET method, that's the simplest communcation, like when you type an address in your browser address bar), and enjoy seeing those low level bytes come to you! :D

helios
A: 

Hi helios,

I Tried & now i can reach the server & get the response from server... But in response serer say Authorization required(Error 407). I did provided the Authorization part in header as " Get http://www.google.com HTTP/1.1<<\n>> Authorization: Basic <><<\n>> <<\r\n>> <<\r\n>>

But still i am getting the same error.(Access denied to cache....).

amit
amit