libfsock: A versatile API with a focus on ultra low latency and efficient data handling

The FastSockets API || LIBFSOCK

When using FastSockets a developer gets access to a lean and mean API focusing on providing a drop less solution on ingress, capturing any packets coming in, yet giving fastest transmit as well. Another benefit is the easy access to timestamps — which can be quite cumbersome when using the socket API. More specific the TX part of looping a packet back to the stack likely to introduce additional jitter.

Kernel Bypass as a requirement for dropless packet capture and lowest tick to trade.
/* create an endpoint for a given IP and proto */
int fsock_open (struct ip_addr *ip, fsock_open_flags_t flags, fsock_endpoint_t *fsock_ep);
/* create channel by giving a port, for unicast , potentially mcast traffic */
int fsock_bind (fsock_endpoint_t fsock_ep, fsock_bind_flags_t flags, int port, fsock_channel_t *fsock_ch);
/* use FSOCK_JOIN_MCAST flag */
int fsock_setopt (fsock_channel_t fsock_ch, fsock_setopt_flags_t flags, void *opt, int optlen);
/* receive unicast/multicast */
int fsock_recvfrom (fsock_channel_t fsock_ch, fsock_recv_flags_t flags, char *buf, int buflen, fsock_recv_info_t *info);

LIBFSOCK Media Extensions for GigE Vision

Introducing libfsock as a GigE Vision SDK: What is nice about the versatile API is that of having a number of so called “recv” flags. In line with the libfsock design we introduced special receive flags which allow for retrieval of special protocols, such as GigE Vision.

Other use cases for low latency

A PoC also showed value in game servers — where a better response time was achieved. E.G the dispatching (serialization delay) of UDP packets is within nanoseconds.


We’ll present a series of performance charts showing the benefits of using libfsock. The depicted UDP serialization delay was measured as a Device Under Test measurement in which the time between arriving packets is shown. This shows how fast the TX portion of the sender actually is — as handing over the data for sends does not indicate when it actually left the device. We see that libfsock has immense performance enhancements, making it suitable e.g for market distribution.

Transparent ABI compatible stacks vs libfsock
tick-to-trade[UDP 1 TCP 1] 744ns mean=787ns, median=784ns, 99%=816ns





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
NEIO Systems, Ltd.

NEIO Systems, Ltd.

16 Followers || low latency, networking experts, 10GbE++, FPGA trading, Linux and Windows internals gurus