mOS-networking-stack icon indicating copy to clipboard operation
mOS-networking-stack copied to clipboard

Example for mtcp_peek?

Open tbarbette opened this issue 3 years ago • 0 comments

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

tbarbette avatar Sep 05 '20 21:09 tbarbette