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

Author Topic: Network kernel buffer size setting  (Read 2706 times)

0 Members and 1 Guest are viewing this topic.

Siwastaja

  • Newbie
  • *
  • Posts: 1
    • View Profile
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Network kernel buffer size setting
« Reply #1 on: July 02, 2011, 10:19:09 pm »
I think this is very specific, SFML is limited (on purpose) to the most common and useful features.
Laurent Gomila - SFML developer