hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeprotea <jepro...@gmail.com>
Subject Re: How to access socks4/5 proxy
Date Tue, 26 Jan 2010 09:28:33 GMT
hi,Oleg
   According to your advices, I've tried it,the code is like this(partial):
.................
 PlainSocketFactory sf = PlainSocketFactory.getSocketFactory();
   Socket socket = sf.createSocket();
   socket.connect(new InetSocketAddress(proxyHost,proxyPort), 0);

   HttpParams params = new BasicHttpParams();
   params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 1000L);

  sf.connectSocket(socket, targetHost, targetPort, null, -1, params);
.....
 however,there is not a established state,only:
>netstat -ano | findstr "1080"
  TCP    10.64.44.176:1080      0.0.0.0:0              LISTENING
2096
  TCP    10.64.44.176:2110      10.64.14.176:1080      SYN_SENT        1440

 if i 've made a mistake to create a socket connection for socks4 proxy ,via
using above funcations included in httpclient-4,I am a novice,~~please
forgive my mistakes, could you give me special advices or exaples for it.

thanks!

On Mon, Jan 25, 2010 at 5:24 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Mon, 2010-01-25 at 10:57 +0800, Jeprotea wrote:
> > Hi,Oleg
> >     I'm using HttpClient-4 and I'm trying to socket connections over a
> > special proxy. To do this I've consulted httpclient-4 tutorial,there are
> > only some simple explanations about
> > OperatedClientConnection,ClientConnectionOperator
> > and so on,however,i have no idea how to create sockets connection to a
> > socks4/5 proxy,if there needs others classes,and how about their call
> > relation,I'll be apreciated if you can give me special advices.I have
> known
> > so far:first,to creat a socket via SocketFactory, and then to get the
> socket
> > by OperatedClientConnection instances,finally, to create connections via
> > ClientConnectionOperator.
> > if i misunderstand it ?
> >
> > please help
> >
> > thanks,
> > Jeprotea
>
> SOCKS protocol works directly with Java Socket objects therefore does
> not require any special support on the HTTP transport level. If a Socket
> instance is configured to connect to a SOCKS proxy, no special
> configuration is required for HttpClient
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message