470,848 Members | 1,690 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

Choose IP

Hello,

I have a little problem here.
I have a server which has multiple IP addresses. I'm writing a program
which connects to a webservice but at run-time I need to decide which
IP to use. Does anyone has an idea about how you can programmatically
set your IP-address in .NET , c# or VB

Greetings
Kenneth

Feb 27 '06 #1
6 1303
Hello, Nattydreadlock!

N> I have a little problem here.
N> I have a server which has multiple IP addresses. I'm writing a program
N> which connects to a webservice but at run-time I need to decide which
N> IP to use. Does anyone has an idea about how you can programmatically
N> set your IP-address in .NET , c# or VB

before calling connect you have to bind your socket to specific IP address.
The sample is like this

Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
s.Bind(new IPEndPoint(ipAddress, somePort));
s.Connect("somewhere", someOtherPort);

The connection will be established from ipAddress address and somePort port

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 27 '06 #2
Hi,

thnx for the answer.

But the problem is that calling a webservice is totally encapsulated in
Visual Studio.NET 2005.

So where can I change the socket over which it will connect?
Where in code should I make these changes?

Greetings

Kenneth

Feb 27 '06 #3
Somone had the same problem today on another newsgroup. This is the answer:

The proxy class generated after adding the service as web reference has a
property called Url, where you can set the location of the service. You'd
also have to set the url behavior to dynamic

"Nattydreadlock" <Be********@hotmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Hi,

thnx for the answer.

But the problem is that calling a webservice is totally encapsulated in
Visual Studio.NET 2005.

So where can I change the socket over which it will connect?
Where in code should I make these changes?

Greetings

Kenneth

Feb 28 '06 #4
Hi,

I think we are not on the same line for this solution. I'll explain the
problem again:

I have a server which has 2 IP addresses. From this server I need to
call a webservice.
This webservice checks on IP address to see if you are calling from an
allowed IP address.
The situation is like this:

The service accepts for each login just one IP address. What I want to
do is to be able to log in with the same program for 2 accounts.
Thus I have to make the service think that when I log in with account 1
my IP address is 62.62.62.62 for example.
When I log in with account two though the service should think that my
IP address is 100.100.100.100 for example.

My server has 2 fixed IP-addresses, so I need to be able to tell the
server from which IP he should send the request.

I hope you understand the problem better.

Thanx

Kenneth

Feb 28 '06 #5
Sorry,

I still made a little mistake here.
I'm not actually calling a webservice, I'm connecting over a secure
channel
something like this :
Dim options As New SecurityOptions(SecureProtocol.Ssl3)
options.AllowedAlgorithms = SslAlgorithms.RSA_AES_128_SHA Or
SslAlgorithms.RSA_AES_256_SHA Or SslAlgorithms.SECURE_CIPHERS
options.VerificationType = CredentialVerification.Manual
options.Verifier = New CertVerifyEventHandler(AddressOf OnVerify)
Me.socket = New SecureSocket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp, options)
Me.endpoint = New
IPEndPoint(Dns.GetHostEntry(Me.server).AddressList (0), Me.port)
Me.socket.Connect(endpoint)

Feb 28 '06 #6
Hello,

I'm using this to connect over an SSL-channel. I think you don't
understand my question here.
I know at design TO which IP I need to connect. At run time though I
want to be able to decide FROM which IP I need to connect.

My own server has two IP's coupled to it and I need to be able to say:
send a request from IP1 or IP2

Greetings,
Kenneth

Mar 3 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ruthless | last post: by
14 posts views Thread by Howard Kaikow | last post: by
3 posts views Thread by giloosh99 | last post: by
12 posts views Thread by Steve | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.