Azure / azure-c-shared-utility

Azure C SDKs common code
Other
111 stars 203 forks source link

[Questions] Is there a way to set socket send and recv buffer size? #534

Closed yunhaoling closed 3 years ago

yunhaoling commented 3 years ago

hey team, I was wondering if there's a way to set the socket send and receive buffer size.

for example, on windows, there's a setsockopt method in winsock.h which can be used to set SO_RCVBUF and SO_SNDBUF.

but I search the code base and there's no place where this method is used.

Do we have setting send and recv buffer size in a different way or it is not supported?

danewalton commented 3 years ago

Hi @yunhaoling yes we do. I think the docs in the upstream C SDK was deleted but I have a PR here to fix that: https://github.com/Azure/azure-iot-sdk-c/pull/2089

Essentially what you're looking for is a compile time definition for this value: https://github.com/Azure/azure-c-shared-utility/blob/11dbe6123de0dab10a3e33d4102a26d41dc52aa2/inc/azure_c_shared_utility/socketio.h#L34-L36

That should get you what you need!