What are SO_SNDBUF and SO_RCVBUF

前端 未结 5 2093
无人共我
无人共我 2020-11-30 23:14

Can you explain me what exactly are SO_SNDBUF and SO_RCVBUF options?

OK, for some reason the OS buffers the outgoing/incomming data but I\'

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 23:34

    Searching Google for "SO_RECVBUF msdn" gave me...

    http://msdn.microsoft.com/en-us/library/ms740476(VS.85).aspx

    which answers your "are they per socket" with these lines from the options table:

    SO_RCVBUF int Specifies the total per-socket buffer space reserved for receives.
    SO_SNDBUF int Specifies the total per-socket buffer space reserved for sends.
    

    With more detail later on:

    SO_RCVBUF and SO_SNDBUF

    When a Windows Sockets implementation supports the SO_RCVBUF and SO_SNDBUF options, an application can request different buffer sizes (larger or smaller). The call to setsockopt can succeed even when the implementation did not provide the whole amount requested. An application must call getsockopt with the same option to check the buffer size actually provided.

提交回复
热议问题