Hi,
I am writing a small application in which computer A sends message to Computer B using socket. Where i want to prevent the number of message sent/second.
So i want to create a message senderThread which will send only N number of message within 1 second. If 1 second is too short for sending N number of messages, rest of the messages should not be sent.
Lets say for example N = 10
so my
thread should sent only 10 messages/second. if my thread finishes sending 10 messages in 100 ms rest of the 900 ms thread should be idle.
in the case where N = 10000
and my thread is able to send 6000 messages in 1 second. rest of the 4000 messages shouldn't be sent.
How do i do that ? Do i have to use threading for handling the scenario of sending N messages/second or there is some other way to handle this scenario ?
I don't have much experience in Thread programming
Thanks & Regards,
Jigar