5 years ago.


Hello Roy,

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?

Greetings, Tim

Question relating to:

A new object oriented network api that can be used to replace the one provided by the EthernetInterface library. cpp, ethernet, network, TCP, UDP
Comment on this question

1 Answer

5 years ago.

Hi Tim,

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.

Regards, Roy

Edit: Updated the TCP Client Example to the latest version of the mbed libraries and fixed the issue.

That's a rather quick response =).

Cheers, Tim

posted by Tim Wöstemeier 15 Nov 2014