How can I set the buffer size for the underneath Socket UDP? C#

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-03-09T10:18:39Z Indexed on 2010/03/09 10:21 UTC
Read the original article Hit count: 209

Filed under:
|
|
|

Hi all

As we know for UDP receive, we use Socket.ReceiveFrom or UdpClient.receive

Socket.ReceiveFrom accept a byte array from you to put the udp data in.

UdpClient.receive returns directly a byte array where the data is

My question is that How to set the buffer size inside Socket. I think the OS maintains its own buffer for receive UDP data, right? for e.g., if a udp packet is sent to my machine, the OS will put it to a buffer and wait us to Socket.ReceiveFrom or UdpClient.receive, right?

How can I change the size of that internal buffer?

I have tried Socket.ReceiveBuffSize, it has no effect at all for UDP, and it clearly said that it is for TCP window. Also I have done a lot of experiments which proves Socket.ReceiveBufferSize is NOT for UDP.

Can anyone share some insights for UDP internal buffer???

Thanks

© Stack Overflow or respective owner

Related posts about udp

Related posts about socket