4

I am trying to write a Windows application which will generate traffic on an ethernet link from a PC.

I want to use webBrowser controls to continuously pull up web pages to generate the traffic.

In this case, i want each webBrowser control linked to a unique source IP address. Two questions:

  1. Is it possible for one PC (i.e. one MAC address) to have multiple concurrent IP addresses assigned?

  2. If the answer to question #1 is yes, is it easiest to use DHCP requests in the applications C# code to obtain the additional IP addresses, or is it easier to just configure static IP addresses?

  3. How do i obtain the IP addresses obtained in step 2 in my C# code (just give me a general idea).

Thanks, Steve

1 Answers1

5

Yes, it's absolutely possible for a single network adapter to have multiple IP addresses. I would however suggest configuring them manually (in Windows you can add additional IP addresses via the Advanced TCP/IP Settings in IPv4 properties of the network connection).

In terms of using those IP addresses, from code it's relatively easy, you can simply bind to a particular local IP address (if using the TcpClient, the TcpClient(IPEndPoint localEndPoint) constructor will allow you to do this).

However if you're using a web browser control it's perhaps rather more difficult, and it may not be possible via the publicly accessible interfaces on the control to bind it to a particular local address.

Providing you don't need any particularly advanced functionality, you may have more luck by creating your own simple HTTP requests and sending them over a suitably bound TcpClient.

Edit:

A quick search turned up this answer which may be of use - whilst it still doesn't allow you to use a graphical web browser control bound to a specific local address, it does enable you to use HttpWebRequest, which will allow you to handle send more advanced web requests (cookies, compression, redirects etc.).

Community
  • 1
  • 1
Iridium
  • 23,323
  • 6
  • 52
  • 74