Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Siwastaja

Pages: [1]
1
Feature requests / Network kernel buffer size setting
« on: June 30, 2011, 05:13:58 pm »
Hello,

First of all, thanks for this very nice project.

I'm using the networking module to receive UDP packets. I migrated from the Boost libraries for many reasons. In Boost, however, there is way to manipulate the OS network socket's buffer in a cross-platform way, e.g.:

Code: [Select]

boost::asio::socket_base::receive_buffer_size option(8192000);
udp_socket.set_option(option);

(boost/asio.hpp)
(boost/asio/basic_datagram_socket.hpp)
,

which, in MS Windows, can natively be issued like this:

Code: [Select]

int dbuf = 8192000;
setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, (CHAR*)&dbuf, 4);

(winsock2.h)


Sorry, I don't have code for Linux.

You probably already got what I'm getting at; it would be nice to see this feature (maybe along with some of the other socket settings) in SFML done in as cross-platform way as possible.

Lengthening the buffer will increase the packet yield in case of high data rate (over 50 Mbps), busy operating system and/or a network adapter with only little on-board buffer, especially if the program does something else at the same time while processing the packets. Example; with a typical 100 Mb/s network adapter (with relatively small rx FIFO compared to Gigabit adapters) in a modern quad-core machine with Windows XP, and 80 Mb/s UDP payload generated by an FPGA, I noticed packet drop of around 1 percent, which went down to about 10 ppm after increasing the OS socket buffer from the default (8192) to 8192000.

Pages: [1]