Go Down

Topic: Adding ethernet library from the arduino IDE results in multiple #includes (Read 638 times) previous topic - next topic

jerseyguy1996

Sep 02, 2012, 11:36 pm Last Edit: Sep 03, 2012, 12:46 am by jerseyguy1996 Reason: 1
I went to add the ethernet library from the Sketch -> Import Library -> Ethernet and I get the following list of #includes in my sketch:

Code: [Select]
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>


Has it always been like this?  I am just setting up a small webserver to pass instructions from my android phone to the arduino over the internet.
Arduino Uno;
Mega328

PGT

i dont know if it always has been like it, but from programming perspective it seams good.
You see all libraries for various sub parts of TCP/IP setup.

As a programmer you can decide if you really want them.
For example if you use a static IP adress you can omit DHCP by put a mark in front of it //
And most services dont rely on udp, as most connections are tcp
udp is for broadcasting and packets can be missed without problems  (used in voice over ip youtube etc).

DNS well ... you might try to mark it out and see if your code still works.
Not sure if you need it, its a lookup service to get a remote IP, but your connecting clients allready have an ip adres so as long as your solution doesnt have to resolve www.somewhere.com/my.data.jpg  etc.. it might work without it.

And if your solution only has a server role (providing data on request)..a client might not be needed too.

So despite i dont have a network add on, from a programmers look it makes sense, and its perfect
as now you can mark out the code you dont need, and thereby use less memory on the arduino

jerseyguy1996


i dont know if it always has been like it, but from programming perspective it seams good.
You see all libraries for various sub parts of TCP/IP setup.

As a programmer you can decide if you really want them.
For example if you use a static IP adress you can omit DHCP by put a mark in front of it //
And most services dont rely on udp, as most connections are tcp
udp is for broadcasting and packets can be missed without problems  (used in voice over ip youtube etc).

DNS well ... you might try to mark it out and see if your code still works.
Not sure if you need it, its a lookup service to get a remote IP, but your connecting clients allready have an ip adres so as long as your solution doesnt have to resolve www.somewhere.com/my.data.jpg  etc.. it might work without it.

And if your solution only has a server role (providing data on request)..a client might not be needed too.

So despite i dont have a network add on, from a programmers look it makes sense, and its perfect
as now you can mark out the code you dont need, and thereby use less memory on the arduino


Thanks!  Given that I know very little about what I am doing I suspect that I will just leave it all in and hope that the compiler optimizes all of the unnecessary code away.
Arduino Uno;
Mega328

Goofballtech


Thanks!  Given that I know very little about what I am doing I suspect that I will just leave it all in and hope that the compiler optimizes all of the unnecessary code away.


Setting up a web server that receives commands from android os is a pretty deep task to get involved in IMHO.

If you don't know the basic ethernet stuff your in for lots of learning and many hours of reading. :-)

Should be fun! Good luck.

lemming

Looking at the library reference on the website and the examples folder in 1.0.1 I cannot see where the

#include <EthernetClient.h>
#include <EthernetServer.h>

are used. In both the client example and the server example they only have:

#include <SPI.h>
#include <Ethernet.h>

Is there somewhere better where this is documented one way or the other?

PGT

as i explained earlier you might not need them all. (or perhaps you do)
programmers of librariers often present you everything, that doesnt mean that your code needs everything
but if they didnt provide it, you had to guess the names.. seams a bit harder to me
and now you can delete lines that you dont need (or mark them out).

simply mark out check if the code still works if ok you dont need it, if it stops you needed it.


I cannot tell you if the code examples you refer to are from the same date as this library
programmers can change whats in their code and how it works, and how it is divided accros their binaries.

PGT

<small add on>

oh and note that SPI is a general interface protocol, to talk against a ethernetcar a gps or whatever.
the code for a network card might go trough a SPI (most likely) but there are different hardware network solutions, so there might be different code too to drive those solutions.

jerseyguy1996



Thanks!  Given that I know very little about what I am doing I suspect that I will just leave it all in and hope that the compiler optimizes all of the unnecessary code away.


Setting up a web server that receives commands from android os is a pretty deep task to get involved in IMHO.

If you don't know the basic ethernet stuff your in for lots of learning and many hours of reading. :-)

Should be fun! Good luck.


I've got the basics of it somewhat figured out....although for some of it I am not 100% sure why it works the way it does.  I currently am able to send a command from my phone that blinks an LED on the arduino.  I was writing a new sketch to be able to send more complex commands to the arduino and I noticed the multiple #include files which I don't remember seeing before.
Arduino Uno;
Mega328

Go Up