473,385 Members | 1,370 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,385 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 4719
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mark | last post by:
Is there anyway I can set up a personal 'remailer' type of thing on my domain ? I can not email a friend at his workplace because his company have put a 'block' on emails from my work address...
3
by: theotyflos | last post by:
Hi all, I have the following: /*--- SNIP ---*/ typedef struct Argument_s { char *address; int type;
18
by: MakisGR | last post by:
I'm having trouble understanding what the following define does. Can anyone provide some assistance? #define SetBits(bits,pos) (((bits)) |= (1 << ((pos) & 7))) -- comp.lang.c.moderated -...
5
by: Stuart Norris | last post by:
Dear Readers, I am attempting to define an array of IPAddress-es in C#. I wish to have a array of address so I can try in order to connect to them in a loop to handle unavailable hosts. ...
18
by: **Developer** | last post by:
I always define events with the parameters ByVal sender As Object, ByVal e As EventArgs Even if they are not used. Seems I read someplace that's the thing to do. So I then do:
3
by: Richard Martino | last post by:
Dear Experts: I am using the new Microsoft Web Services Enhancements (WSE) to send SOAP messages from a client to a web service. How can I get identifying information of the sender (aka...
2
by: SharpSmith | last post by:
hi all i have a very specific question regarding emails sending and googling doesn't help me is a way exists to send email using .NET framework (System.Web.Mail or something else) and have the...
4
by: yancheng.cheok | last post by:
Recently, I try to replace #define with const in header file. However, there are concerns on, multiple const object will be created, if the header file is included in multiple cpp files. For...
5
by: MoslyChang | last post by:
Hi, All When I look at effective c++,item2 and item3. I have some basic questions , Does anyone be familar with this topic? it suggests const is perfer to #define, then I think how to replace...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.