Urlconnection Problem / more local IP's

T

Testbm

Hello,
i have got a problem. I have virtuell IP's on a mischine, and I want use one
special IP for outgoing requests with UrlConnection. Does anyone know, how I
can do it.


Greetings Markus
 
J

John Davison

Testbm said:
Hello,
i have got a problem. I have virtuell IP's on a mischine, and I want use one
special IP for outgoing requests with UrlConnection. Does anyone know, how I
can do it.


Greetings Markus

I spent a little bit of time looking into this. After reading through
some of the source code for HttpURLConnection, URLConnection and URL, it
looks like you would need to create a custom URLStreamHandler (which
bind()s to the IP address you want when you connect) to pass to a URL
constructor, of which later you would use getConnection() to obtain the
HttpURLConnection.

Investigating the source code to these classes should lead you to the
result you want.

John Davison
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top