Skip to content

Commit

Permalink
sendmsg/recvmsg; return the number of bytes
Browse files Browse the repository at this point in the history
Return the number of bytes sent/received. The msghdr structure contains
a pointer to an iovec which may consist of several buffers. The sendmsg
and recvmsg NIFs are not aware of the size and number of the buffers.
  • Loading branch information
msantos committed May 28, 2013
1 parent 8ba3d93 commit b4efdcd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions c_src/procket.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,9 @@ nif_recvmsg(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
if (n < 0)
return error_tuple(env, errno);

return enif_make_tuple2(env,
return enif_make_tuple3(env,
atom_ok,
enif_make_ulong(env, n),
enif_make_binary(env, &msg));
}

Expand Down Expand Up @@ -674,8 +675,9 @@ nif_sendmsg(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
if (n < 0)
return error_tuple(env, errno);

return enif_make_tuple2(env,
return enif_make_tuple3(env,
atom_ok,
enif_make_ulong(env, n),
enif_make_binary(env, &msg));
}

Expand Down

0 comments on commit b4efdcd

Please sign in to comment.