win32 udp buffer size

3 отговора 90 прегледа
#1

win32 udp buffer size

някой може ли да ми каже какъв е стандартния размер на буфер за удп сокет под уин? Също така дали отдолу имплементацията е същата като в БСД (т.е. списък от по-малки буферчета).

Мерси

Отговор
в отговор на purist #2

Re: win32 udp buffer size

Тва ако ти свърши някаква работа - get/setsockopt:

SO_RCVBUF

This is a simple option that either returns the size or sets the size of the buffer allocated to this socket for receiving data. When a socket is created, a send buffer and a receive buffer are assigned to the socket for sending and receiving data. When requesting to set the receive buffer size to a value, the call to setsockopt can succeed even when the implementation does not provide the entire amount requested. To ensure that the requested buffer size is allocated, call getsockopt to get the actual size allocated. All Win32 platforms can get or set the receive buffer size except Windows CE, which does not allow you to change the value—you can get only the receive buffer size.

One possible reason for changing the buffer size is to specifically tailor buffer sizes according to your application's behavior. For example, when writing code to receive UDP datagrams, you should generally make the receive buffer size an even multiple of the datagram size. For overlapped I/O, setting the buffer sizes to 0 can increase performance in certain situations: when these buffers are nonzero, an extra memory copy is involved in moving data from the system buffer to the user-supplied buffer. If there is no intermediate buffer, data is immediately copied to the user-supplied buffer. The one caveat is that this is efficient only with multiple outstanding receive calls. Posting only a single receive can hurt performance, as the local system cannot accept any incoming data unless you have a buffer posted and ready to receive the data. For more information, see the section called "Other Issues" under the completion port I/O model in Chapter 8.

Сигнатура!
Отговор
в отговор на Questor #3

Re: win32 udp buffer size

мерси, това ме ориентира донякъде. По-конкретно ме интересува следното:

знам че тъй като буфера на БСД удп сокетите всъщност е списък от по-малки буферчета, всяко от които може да съдържа само една датаграма, целия буфер може да се препълни с много по-малко информация отколкото може да побере. Т.е. ако имам 16 малки буферчета всяко по 1кб и получа 16 датаграми от 32 байта буфера за сокета ще бъде запълнен независимо че има само 512 байта в него.

Доколкото знам вин32 сокетите са базирани на БСД сокетите. Та въпроса ми е дали те имат същия недостатък и ако да, какъв е размера на малките буферчета.

Мерси предварително

Отговор
в отговор на purist #4

Re: win32 udp buffer size

ами нямам идея. ето тука мисля че има доста инфо, и линковете от него

[линк]
[линк]

Сигнатура!
Отговор