Closed nvh2001 closed 3 months ago
@nvh2001 you don't need if you put packet into thread/async method after OnReceive.
@nvh2001 you don't need if you put packet into thread/async method after OnReceive. Do I need to lock client to ensure that a client can only process one of its packet at a time?
@nvh2001 you don't need if you put packet into thread/async method after OnReceive. Do I need to lock client to ensure that a client can only process one of its packet at a time?
No
In other words, each data you receive is a different and distinct object, if you receive 100 packets simultaneously the 100 packets will be a different instance and will contain different contents so there is no need to block the data.
Only the internal buffer blocks the data, because the internal buffer is just an instance that receives the data and then moves the content to a new instance (you receive this new instance as a parameter).
So what you were thinking is that you have access to the internal buffer and that's not what happens.
What happens is that you have access to a copy of the internal buffer (that's why the size of the paramter buffer only allocates the size of the content) the internal buffer allocates more space to be able to receive dynamic amounts of data.
Tell me if you have any questions! @vanhaodev @nvh2001
I want all clients to not have to wait for others and a client just handle 1 package at the same time.
Am i wrong with this code?