mike said:
REGARD:
A -> B -> C
<- <-
A is client
B is proxy
C is server....
HOW TO WRITE PROGRAM TO RECEIVE DATA WHICH C TRANSFER TO B make a
dealing and then TRANSFER TO A?
THANK YOU VERY MUCH.....
BEST REGARDS
Not sure what you mean by "make a dealing".
I assume that you are talking about a HTTP Proxy server, that supports
the CONNECT method.
In order to communicate with C from A, A must open a socket to B (using
the port of the proxy software), send
CONNECT C
ort HTTP/1.0\r\n
\r\n
on the Socket.getoutputStream()
read a response of the form:
HTTP/1.0 200 OK\r\n
Header1: x\r\n
Headern: x\r\n
\r\n
from the Socket.getInputStream(). At this point, once you have read the
last \r\n, you effectively have a direct connection to C, on the port
specified. You can wrap the socket's InputStream and OutputStream using
whatever other classes you want,or do whatever else you want to.
possible complications: The proxy may require authentication, or not
permit you to connect to C, or the particular port on C. In which case,
you will not receive a response "200 OK", rather a response starting
with 4xx. If this happens, you will not be able to connect to C.
Hope this helped.
Rogan