Important changes to questions
We’re making some changes to Mbed Questions. From 10th December 2019 this site will be archived and new questions should be asked on our new forum site. Until that date you can continue to reply to existing questions here but can’t ask new questions.
5 years ago.
I'm trying out your TCP client example, but it seems the method Buffer::pointer() is non-existant according to the compiler and checking the source files for Buffer.
The mbed compiler error: Error: Class "network::Buffer" has no member "pointer" in "main.cpp", Line: 38, Col: 71
Your example program tries to call it from line 40:
line from example program TCP Client
printf("Received %d bytes:\n\r%s\n\r", result, (char *)buffer.pointer());
Am I missing something or did something break in your library?
Question relating to:
5 years ago.
The be honest it has been a while since I have invested time in the library. As a result of this I have also no idea how compatible it is with the latest mbed libraries :) Anyways to answer your question, after a quick look I think it has to be:
printf("Received %d bytes:\n\r%s\n\r", result, (char *)buffer.data());
Somehow I must have forgotten to update the example project. I'll see if I can compile the project myself and update to the latest versions of the mbed library.
There is an obvious limitation to the buffer class as well that you need to be aware of. The buffer class allocates dynamic memory when instantiated. If you only do this during the initialization of your application this is not a problem. Then the same memory area will be used throughout the run-time of the application. If you constantly allocate and destroy buffer objects you might fragment the controllers memory. Microcontrollers generally lack an MMU which normally mitigates the problem of fragmentation of memory.
Edit: Updated the TCP Client Example to the latest version of the mbed libraries and fixed the issue.