473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1421
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DaBoo | last post by:
Hi! I'm creating dynamic a XML file. in this file are store some informations about images i use in HTML datasheets. i'm going to transform the XML file with XSLT. My Problem is, that {image}...
2
by: Ruthless | last post by:
Hello. I've got a question about xsl:choose I've got an element <person> with the sequence of <first_name><last_name><date_bith> and <info> and the info is not obligatory(minOccurs="0") ...
14
by: Howard Kaikow | last post by:
Can I use a bookmark to selectively choose the code to be run? For example. Suppose we have the following in an HTML file: <html>
6
by: Penny | last post by:
Hi all, I've built a simple search <Form> on a web page that is intended to allow the user to search a record store database. There is a drop down box where the user can choose either 'Artist'...
3
by: Anders Borum | last post by:
Hello! I've come across a strange error that occurs, when you try to return a nodelist from a variable with a choose/where/otherwise statement. I'm not quite sure whether it's a bug or simply...
3
by: giloosh99 | last post by:
Hello I have a report that needs to printed by a specific printer rather than the computers default printer? Is there a way to dynamically choose a specific printer to print a report through VBA...
12
by: Steve | last post by:
Can the Choose function be used to set the criteria for a field in a query to either "Is Null" or "Is Not Null" based on the value of an option Group on a form? Such as:...
14
ADezii
by: ADezii | last post by:
The tendency of VBA code to evaluate all expressions, whether or not they need to be evaluated from a logical standpoint, makes the use of the IIf(), Switch(), and Choose() Functions inefficient and...
5
by: lsllcm | last post by:
Hi All, I have one question about many "or" operation make system choose incorrect index There is one table TT ( C1 VARCHAR(15) NOT NULL, C2 VARCHAR(15) NOT NULL, C3 VARCHAR(15) NOT NULL,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.