None
None

Reputation: 617

How to set an automatic BufferSize?

I'm using the Socket.BeginReceive method in order to receive data from connected clients. However, the messages I send may vary too much in size. For example, one message may be 100,000 bytes in size and the other may be 3 bytes in size, and the 100,000 bytes message is rarely sent! Is there a way of setting theBufferSize value to an automatic value just like the usage of Socket.Receive?

Upvotes: 0

Views: 58

Answers (1)

John Mellor
John Mellor

Reputation: 181

Set your buffer size to maximum unit transmission (MTU) size of IP packet (64 KB). It never exceeds that size because larger messages are fragmented so they could be transmitted easier.

Upvotes: 1

Related Questions