lwip/sockets.h problem

28 Jul 2010 . Edited: 28 Jul 2010

I import lwip library for my project. when i include sockets.h like in "EthernetTester" and define a statement which is :

a = socket(AF_INIT, SOCK_STREAM,O);('a' is defined integer)

i get some errors and warnings.  these are

"Identifier "AF_INET" is undefined (E20)" in file "/server/main.cpp"

"Identifier "SOCK_STREAM" is undefined (E20)" in file "/server/main.cpp"

"Identifier "socket" is undefined (E20)" in file "/server/main.cpp"

and warnings are;

"Variable "mem_sem" was set but never used" in file "/server/lib/lwip/Core/lwIP/core/mem.c"

"Variable "a" was set but never used" in file "/server/main.cpp".

Although "AF_INET","SOCK_STREAM" and "socket" are defined in sockets.h what are these errors and warnings mean?

what is wrong?

Thanks already now.

28 Jul 2010

Hi Basar,

The LwIP sockets API was not included in the LwIP package.

If you want to do some sockets programming, I'd advise you to have a look here: http://mbed.org/cookbook/Sockets-API.

Donatien

29 Jul 2010

Hi Donatien,

Thanks for intrest but when i include NetServicesSource lib and compile this code:

#include "mbed.h"
#include "NetServicesSource.h"

int main(){

return 0;
}

i get a lot of warnings and just one error.

This error is:

"Cannot open source input file "gprsmodule.h": No such file or directory (E5)" in file "/server/lib/NetServicesSource/drv/gprsmodule/GPRSModule.cpp"

I just want to do sockets programming for now. Actually only TCPSocket. Is there any chance to do it without using irrelevant header files?

Thanks.

ps: when i'm including header files i use "" eg: "TCPSocket.h"

but if i use <> instead of "" which folder are looked for?


03 Aug 2010

Hi Basar,

There is no "NetServicesSource.h" file, if you want to use TCP sockets you'll have to include "TCPSocket.h".

Did you have a look at http://mbed.org/cookbook/Sockets-API ?

Donatien