471,319 Members | 3,066 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

How to define sender IP address?

Hello everybody,

is there anybody who knows how to set a sender IP address in C#.
I want to send UDP packets to a server and simulate different computers
with different IP addresses. The server always expects a different IP
address in the UDP packet. So I need a possibility to set the sender
IP.
Hopefully anybody knows something about this topic.

Thanks a lot!
Greeting Marcel

Feb 7 '06 #1
14 4578
Hi,
"Marcel Bode" <mb*****@freenet.de> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hello everybody,

is there anybody who knows how to set a sender IP address in C#.
I want to send UDP packets to a server and simulate different computers
with different IP addresses. The server always expects a different IP
address in the UDP packet. So I need a possibility to set the sender
IP.
Hopefully anybody knows something about this topic.

You do realise thhat you will not get any response from the server right?

The response packages will be send to the machine with that IP address.

A better suggestion would be if you assign differents IPs to your local
computer and then select from these IPs when you create your local
IPEndPoint.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 7 '06 #2
Hi,

I think your suggestion, is the correct way but I am trying to simulate
5000 different computer with 5000 different IP addresses.....hmmm I
think it's not easy

But thanks a lot!

Marcel

Feb 7 '06 #3
Hi,
"Marcel Bode" <mb*****@freenet.de> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hi,

I think your suggestion, is the correct way but I am trying to simulate
5000 different computer with 5000 different IP addresses.....hmmm I
think it's not easy


What is what you want to do in the first place?

Why you need 5K differents IPs?
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 7 '06 #4
Hi,

okay it's a stress test! You know, I am trying to test a application on
a server. The server expects a logon from different devices or in this
case only one computer. Every device must have a unique IP address. To
see how the system handles maybe a logon from 5000 devices at the same
time, I want to programm a simulation application.
So all the logon information from the device must have different IP
addresses.
Hopefully now you know the main background.

bye Marcel

Feb 7 '06 #5
Hello, Marcel!

( http://mixter.void.ru/rawip.html ) - says how custom UDP packets can be created.
There is source code for TCP packet generation. UDP header is smaller thus simpler to generate.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 7 '06 #6
Hi,
"Marcel Bode" <mb*****@freenet.de> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,

okay it's a stress test! You know, I am trying to test a application on
a server. The server expects a logon from different devices or in this
case only one computer. Every device must have a unique IP address. To
see how the system handles maybe a logon from 5000 devices at the same
time, I want to programm a simulation application.
So all the logon information from the device must have different IP
addresses.
Hopefully now you know the main background.


In this case I would generate a fake ip in the server side, each time a new
session start you , instead of getting the source IP (most probably using
Page.UserHostIP ) you generate a new IP:

// string sourceIP = Page.UserHostIP ;
string sourceIP = GenerateRandomIP();

and then you can do your stress test from one computer only

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 7 '06 #7
Change the server to temp remove the logic and checks for dup IPs, then you
can stress. After, uncomment the logic and test it again with fewer source
IPs.

--
William Stacey [MVP]

"Marcel Bode" <mb*****@freenet.de> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
| Hi,
|
| okay it's a stress test! You know, I am trying to test a application on
| a server. The server expects a logon from different devices or in this
| case only one computer. Every device must have a unique IP address. To
| see how the system handles maybe a logon from 5000 devices at the same
| time, I want to programm a simulation application.
| So all the logon information from the device must have different IP
| addresses.
| Hopefully now you know the main background.
|
| bye Marcel
|
Feb 7 '06 #8
Hello, Ignacio!

IMN> In this case I would generate a fake ip in the server side, each time
IMN> a new session start you , instead of getting the source IP (most
IMN> probably using Page.UserHostIP ) you generate a new IP:

IMN> // string sourceIP = Page.UserHostIP ;
IMN> string sourceIP = GenerateRandomIP();

IMN> and then you can do your stress test from one computer only

IMO OP didn't state that this is web app, so we can have no Page class.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 8 '06 #9
Hello, Marcel!

MB> okay it's a stress test! You know, I am trying to test a application on
MB> a server. The server expects a logon from different devices or in this
MB> case only one computer. Every device must have a unique IP address. To
MB> see how the system handles maybe a logon from 5000 devices at the same
MB> time, I want to programm a simulation application.
MB> So all the logon information from the device must have different IP
MB> addresses.
MB> Hopefully now you know the main background.

What kind of application it is? Is it hosted on IIS. Does the application determine IPs duplication?

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

it's no web server or something like that. The server side is a Java
application with connecting to a database. It is effectively the
central for all existing devices. When a device wants to join the
system it must logon and then it can use the services and the central
application you can observe the devices. I don't want to change the
server side, because maybe then I also change the results of the
simulation. And I don't have access to the source code of the central
side. I can only change the client/device side. That's it!

Now I am trying some hacking tools. They are very powerful and when I
install such a tool on the server side, it maybe can filter the
outgoing and incoming udp packets and change the IP. Maybe it's quite
easier then searching for a solution in C#.

But hey, I thank all of you! If you still have some suggestions, let me
know!

Bye Marcel

Feb 8 '06 #11
Hi,

"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:Oi**************@TK2MSFTNGP14.phx.gbl...
Hello, Ignacio!

IMN> In this case I would generate a fake ip in the server side, each time
IMN> a new session start you , instead of getting the source IP (most
IMN> probably using Page.UserHostIP ) you generate a new IP:

IMN> // string sourceIP = Page.UserHostIP ;
IMN> string sourceIP = GenerateRandomIP();

IMN> and then you can do your stress test from one computer only

IMO OP didn't state that this is web app, so we can have no Page class.


You are right, my mistake, but the same apply to any platform , just change
the line from where you are getting the remote IP and use a generated IP.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 8 '06 #12
Hi,

And why is so important the IP?

Are you doing any validation/auth based on that?

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 8 '06 #13
Hello, Marcel!

Relying on the fact that only different IPs can send data will cut off user that are behind NAT or proxies.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 8 '06 #14
hi,

the different IP makes sure that the logon information is coming from
different devices.
So yes, it's a kind of validation!

bye

Feb 8 '06 #15

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Mark | last post: by
3 posts views Thread by theotyflos | last post: by
18 posts views Thread by MakisGR | last post: by
5 posts views Thread by Stuart Norris | last post: by
18 posts views Thread by **Developer** | last post: by
5 posts views Thread by MoslyChang | last post: by
reply views Thread by rosydwin | last post: by

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.