xref: /mOS-networking-stack/docs/man/mtcp_write (revision dcdbbb98)
mtcp_write 3 2017-02-01 "Linux" "mOS Library Functions Manual"
NAME
mtcp_write - send bytestream to an mTCP socket
SYNOPSIS
#include <mtcp_api.h> "ssize_t mtcp_write(mctx_t " mctx ", int " sockid ", char *" buf ", size_t " len );
DESCRIPTION
mtcp_write () sends up to "len" number of bytes from the buffer that is being pointed by "buf." The bytestream is sent to the mTCP socket using the "sockid" descriptor. An mtcp_write() function call may write less number of bytes than "len" if there is insufficient space in the write buffer of the socket. In such a case, the return value is considered the actual number of bytes successfully written. mtcp_write () call takes an additional argument named "mctx" that represents the per-core mTCP context in an application (see mtcp_create_context() for details). """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
RETURN VALUE
On success, the number of bytes dispatched via the socket are returned. The number of bytes sent can be less than "count" if there is insufficient space in the write buffer of the socket. On error, -1 is returned and "errno" is set appropriately. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
ERRORS

10 "EAGAIN" The write buffer of the socket is currently full. The user should call the write function again once the write buffer has space available.

10 "EBADF" "sockid" is not a valid socket descriptor for writing.

10 "ENOTCONN" The underlying connection is not in a TCP state that allows data transmission (i.e. the TCP flow is neither in "ESTABLISHED" or "CLOSE_WAIT" state).

10 "ENOTSOCK" The socket referred to by "sockid" is not valid. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""".SH CONFORMING TO
""""POSIX.1-2001.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

AUTHORS
mTCP development team <[email protected]> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
SEE ALSO
mtcp_bind (), mtcp_listen (), mtcp_accept (), mtcp_connect (), mtcp_read (), mtcp_socket () """""""""""""""""""""""""""""""""""""""""""""""""""""
COLOPHON
This page is part of mOS release 0.3 "docs" section. A description of the project, and information about reporting bugs, can be found at \%http://mos.kaist.edu/. """""""""""""""""""""""""""""""""""""""""""""""""""""