Reputation: 4305
I want to change udpclient receivebuffersize in order to prevent buffer overflow when receiving udp packets. is it possible to change it in c#. The actual property is UdpClient.Client.ReceiveBufferSize. Do i have to use other method?
Thanks.
Upvotes: 2
Views: 3383
Reputation: 29632
I don't know whether this helps, but it looks like UdpClient
allows you to provide your own Socket
. Internally, UdpClient
creates the Socket
with this statement:
new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
In the Connect()
, it checks whether Client
has already been set and, if so, uses that Socket
to connect to.
Upvotes: 0
Reputation: 49978
You should be able to doing the following:
UdpClient client = new UdpClient();
client.Client.ReceiveBufferSize = 4096;
Upvotes: 2