lwIP Wiki
Advertisement

netbuf_data[]

err_t netbuf_data ( struct netbuf * aNetBuf, void ** aData, u16_t * aLen );

Get a pointer to the data of an netbuf object and the length of the data.

  • in aNetBuf : the netbuf object in focus
  • out aData : reference to copy the address of the data to
  • out aLen : reference to copy the length of the data to
  • return : ERR_OK on success, or ERR_BUF if there are no data (buffer error)

For example, if you get a netbuf object as a result to a call to "netconn_recv()", you could use this function to access the data you received. Note that the memory may not be contiguous. You might have to use "netbuf_first()" and "netbuf_next()" to scan through all the memory.

Alternatively you could use "netbuf_copy" to get all of the data at once.

(last changed: Sept. 26, 2011)

Advertisement