4

I have a socket program written in Java.

The server makes use of DatagramSocket to create a socket with a particular port number. I have a client java program, which connects to this server and sends some messages.

Currently I have 3 laptops so I use 1 to run the server and the remaining 2 to be clients. How can I simulate 100 clients?

I am thinking of writing a wrapper around the clients and call them 100 times, but the problem is with the ip-address for those simulated clients NOT being unique. Any guidance appreciated.

Kingkong Jnr
  • 1,128
  • 4
  • 18
  • 29

2 Answers2

3

I would say use JMeter http://jmeter.apache.org/

TCP sampler: http://jmeter.apache.org/usermanual/component_reference.html#TCP_Sampler

You can call Java directly: http://jmeter.apache.org/usermanual/component_reference.html#Java_Request

znurgl
  • 1,077
  • 7
  • 12
  • Will JMeter not use the same IP address for each client connection? The OP stated in his question that he wants a unique IP to be used for each client. – mdewit Jun 15 '16 at 12:30
2

the problem is with the ip-address for those simulated clients NOT being unique

No, the problem is that you are only identifying clients by their IP address. You should use IP:port, for example, via DatagramSocket.getRemoteSocketAddress().

Then you can test by running 100 instances of your client program in a single host.

user207421
  • 305,947
  • 44
  • 307
  • 483