nghttp2_session_mem_send(nghttp2_session *session, const uint8_t **data_ptr)¶
Returns the serialized data to send.
This function behaves like
nghttp2_session_send()except that it does not use
nghttp2_send_callbackto transmit data. Instead, it assigns the pointer to the serialized data to the *data_ptr and returns its length. The other callbacks are called in the same way as they are in
If no data is available to send, this function returns 0.
This function may not return all serialized data in one invocation. To get all data, call this function repeatedly until it returns 0 or one of negative error codes.
The caller must send all data before sending the next chunk of data.
This function returns the length of the data pointed by the *data_ptr if it succeeds, or one of the following negative error codes:
Out of memory.
This function may produce very small byte string. If that is the case, and application disables Nagle algorithm (
TCP_NODELAY), then writing this small chunk leads to very small packet, and it is very inefficient. An application should be responsible to buffer up small chunks of data as necessary to avoid this situation.