Writes data to a connection.
rrid_t rascal_write( rrid_t conn, const char *buffer, unsigned int buffer_size );
conn
Identifier of the connection that the data must be retreived from. If the handle does not correspond to a valid data oriented connection, an error is reported.
buffer
, buffer_size
Location and size of the block of data must be sent. The function copies the data to the connection's internal buffer, thus buffer
may point to stack-based data.
For datagram connections, one call to rascal_write
adds one datagram to the outgoing buffer. The library truncates datagrams to 2048 bytes; the underlying transport provider may truncate it to an even smaller size. The common size limit for a datagram is 512 bytes.
For stream oriented connections, there is no limit on the size of the data.
Return value.
On success, the function returns REC_SUCCESS. Otherwise, the corresponding error message can be retreived with rascal_get_errmsg
. If the function fails, it does not necessarily mean that the connection is no longer usable; instead, the application should wait for a rop_close
event to prove that.