Skip to content

Example for mtcp_peek? #30

@tbarbette

Description

@tbarbette

Hi all,

I get [ mtcp_peek: 297] tcprb_ppeek() failed when trying to use mtcp_peek. What I want is to read all, ordered TCP payload.

Is there any example beyond http://mos.kaist.edu/guide/programmer/05_api_example.html ?

I used the nat example, from which I removed the nating part. I register the callback like this:

 mtcp_register_callback(mctx, sock, MOS_ON_CONN_NEW_DATA, MOS_NULL, callback);

The callback is basically only doing this:

char buf[1024];
while ((r == mtcp_peek(mctx, sock, side, buf, 1024)) > 0 && r < 1024);

Thanks,
Tom

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions