0

I have Created A UDP Server-Client application. There is only single thread at Server's side which continuously executes recvfrom(). If I run 3 Clients Simultaneously from 3 different machines, and send some data, the Server is able to read the data from each of the client. But how can I test the reliability of this application? How would I know how many Maximum number of Clients can this Server handle at a time? Also what is the maximum Payload?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Ayse
  • 2,676
  • 10
  • 36
  • 61

1 Answers1

1

But how can I test the reliability of this application?

Run as many clients as you can. The more clients you can run and send data, the better. Try to run many clients of different machines, and on each machine try to run as many clients as you can, and keep sending data automatically.

Make the clients send data in a loop, without waiting for input, and put a delay between each call to send. A few seconds of delay is fine, then you can lower the delay later and see how your server is handling it.

How would I know how many Maximum number of Clients can this Server handle at a time?

You can't. You are using a UDP server, and UDP is connectionless. Clients do not need to connect to the server to send data, they just send it. Usually it is limited by available resources (memory, etc.) on your server.

Also what is the maximum Payload?

The maximum payload of what? A UDP message? You can read more about the UDP packet structure.

Karim ElDeeb
  • 375
  • 2
  • 7
  • Done it by putting 2 sec delay before each call to sendto(). But since sendto() is sending the same data automatically, and Server seems to be reading it as well, but how would I know that Server has missed something or not? :( – Ayse Mar 15 '13 at 10:14
  • well.. I want to know what is the maximum payload my UDP Server can read? In other words, what is the maximum payload Client is able to send. – Ayse Mar 15 '13 at 10:15
  • 1
    Put a counter like `int messages;` and increase it after every send from the client and server, and compare both and see how many sent and how many received. About the maximum payload, you should see it in the link above, in the UDP packet structure and [here](http://stackoverflow.com/questions/3292281/udp-sendto-and-recvfrom-max-buffer-size). – Karim ElDeeb Mar 15 '13 at 10:22
  • Thank you Karim. I found that since I am using AF_INET, and that makes it a IPV4 UDP Socket, and maximum payload for IPv4 is 65,507 bytes, so does this mean that to check my communication for maximum payload, I will have to make a char sendBuffer[65507] and send 65507 bytes over it and at the Server side, I will make a char receiveBuffer[65507] and will see if all the 65507 bytes of data have been received correctly? – Ayse Mar 15 '13 at 10:30
  • 1
    No, please don't. That is the maximum size of a UDP packet. The size of socket send and receive buffers in Windows is 8192. If you want to send more than that, then you have to split the data and use multiple send. – Karim ElDeeb Mar 15 '13 at 10:42
  • ohhhh.. I know how dumb I am. Thanks a lot once again :) – Ayse Mar 15 '13 at 10:52