Skip to main content

Awesome pysockmmsg created by pappacena

Project description

pysockmmsg

codecov CI

Python wrappers for Linux's sendmmsg and recvmmsg system calls.

When sending/receiving a large amount of packets, preparing the data to be send/received using only a single system call can improve a lot the overal performance by reducing kernel/userland context switching.

Install it from PyPI

pip install pysockmmsg

Usage

Sending multiple messages at a time

import socket
from pysockmmsg import sendmmsg

data_to_send = {
    ('10.10.1.20', '5555'): [b"msg1", b"msg2", b"msg3"],
    ('10.10.1.25', '5555'): [b"msg4", b"msg5"],
    ('10.10.1.26', '5555'): [b"msg6", b"msg7", b"msg8", b"msg9"],
}

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sendmmsg(sock, data_to_send, total_packets=9)

Development

Read the CONTRIBUTING.md file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysockmmsg-0.0.2.tar.gz (15.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page