Arduino on Lan

Sparkfun (and others, no doubt) do a range of modules to connect Arduinos to ethernet LANs.

There's even one that has a chip in it that does the "heavy lifting" of setting up a webserver at the IP address (something like, in my beginner's world) being used by the module, as seen from elsewhere on the LAN.

All of this, by the way, in a Windows context, where it matters. Sigh.

I'm new to webservers, etc. Can I have two webservers on one LAN? (I already have one, running in a PC, on the http-usual(?) port 80, which serves pages not only to the LAN, but to the wider internet... my FarWatch project (weather and pictures,

If I put the Arduino's LAN module's webserver on a different port (81? What would be good?), would that set me up so that an "ordinary" request for a page (from the outside world, to port 80) would be served as before, and leave the "new" server on the same LAN out of things unless I pointed a browser running in a PC on the LAN to, continuing my example,

Am I recommended to go down the "surface it through a webserver" route? I've made PCs talk to each other across a LAN through file sharing.... I set up shared folders, and "messages" go from PC to PC by means of files saved in those folders. Is this a (sensible) option for connecting an Arduino to other devices on a LAN?

There's more on my hopes and wishes at...

... if you feel really generous about contributing to the erosion of my ignorance in this area.

Despite all appearances, I'm not so much seeking an education in things LAN and webserver, as in hearing from people who have "been there, done that", put Arduinos on LANs, and can save me blundering around in the forest.

For less than $60, what modules are good? What features are important? I'm drawn to the modules which have a serial interface to the Arduino, as I would hope that those modules have a bigger market than, say, the Arduino ethernet shield.

Hello tkbyd! I'm fairly new to arduino, but I got an ethernet shield with mine as I want most of my projects to connect to the web.

You can have as many servers as you want on your LAN (well, nearly). They all have different IPs, so it doesn't really matter about the ports. I'd stick to keeping them on port 80 - it'll be less of a faff when typing in the address in the browser.

If you want your current web server and you arduino to be accessible from the outside web then you must add port forwarding in your router. That'll have to be on another port, but your arduino doesn't. Currently you have yourExternalIP:80 -> yourInternalServer:80 You'd need to add yourExternalIP:8080 -> yourArduinoServer:80

What ports you pick don't really matter, but 8080 or 8800 are common - if you start putting a random number in chances are it'll be in use by something else, and while it doens't particularly matter something might get confused.

What I do (so of course I think this is the best method. It probably is, but don't take my word for it) so have the arduino push data to my web server, rather than act as the server itself. This way, the hard work of serving web pages is taken by the web server. This uses fewer resources on the arduino and allows more complicated web sites to be done.

I use PHP, but I guess you could also use ASP or CGI, Perl, etc (they're all server-side languages that let you do more complex things than HTML alone will allow). You can pass data in the url. If you look at the URL here, you've got the page name: followed by some variables. I get my arduino to pass data to the server using the url, and receive data back by having the server generate a very simple page. The simpler the better - it makes the burden on the arduino smaller.

As mentioned, I use the arduino ethernet shield for no particular reason. I didn't know there were different ones at the time, but you'll want to check that there's a decent amount of people using it so you can get good support.

Oh, duh! Sorry to look stupid and make eveyone wonder if I would understand any answer of more than two words of two syllables....

You can have as many servers as you want on your LAN

It happened like this:

I have a webserver on my LAN already, one that you can access from anywhere on the interent. I didn't think long enough about "which server would serve, if I had two webservers on the LAN, and a request came in "from the outside world"?". I'd forgotten the "little detail" of the setting inside my router, which takes care of that.

Thank you CowJam for getting me past the mental log-jam. All my worries about using a different port have been laid to rest.

Comments on other aspects from my original post still of interest!