Skip to content

Support passing flags to c_recv #243

@farnoy

Description

@farnoy

Hi,

I have a usecase where I want to read 4 bytes that define the message length that comes after it. If I read 4 bytes and then 16000 for example, I need to concat both bytestrings for my parse library, which makes a costly copy. I believe that a clean solution would be to recv the first 4 bytes with a flag MSG_PEEK and then read 16000+4 bytes again as one buffer, which would avoid the expensive append later. I noticed that flags passed to c_recv is always 0.

Could we provide an API for this? I can implement it, but I wanted to ask first about how this should be handled (portability could be an issue I believe).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions