Get client's IP address from ethernet server?

Is there a way to obtain the client's IP address when they connect to my server running with the ethernet library? I'd really like to log this for people who connect to my Orbduino project: Thanks!

Couldn't you get it from the hosting for the main webpage rather than the arduino ?

I've just had a play. It could do with a rotatable wrist IMO :)

Errrmmm, could you stand the cup back up please.......... :)

Pluggy- Thank you for the feedback. I'd thought about trying to do this from the hosted web page, but I'm just much more proficient in C and have limited web deveopment experience. If that's the only solution, I'll have to figure it out. I was just hoping there was a way from the Arduino, since that's where I'm logging from anyway. Also thanks for giving it a run. I completely agree with you regarding wrist rotation. I picked the most reasonably priced and hackable arm I could find, but this is a limitation. I'm happy to stand the cup back up for you, but unfortunately I'm at work right now. It will be stood up in a few hours when I get home. Thanks again! :)

Most, if not all web hosting keeps logs by default, its just a matter of pulling the info out, however depending on the hosting, it can be difficult to get to. If its a server you control or its a VPS, its comparatively straight forward, it can be a pain on some shared hosting deals, especially if you want the logs in real time.

The camera appears to have crashed BTW.

Considering the low cost of the Robot, The lack of a rotatable wrist isn't too big a deal, I played with it before I looked at the site selling them. Its excellent for fifty odd bucks.

Ya, the web page is on a hosted site. But the individual actions are direct commands to the server running on the Arduino. It just seems like that transaction should have the client's IP and just be a matter of the Ard Server code capturing it. Or maybe I'm way off...

Hmmm... Camera seems to be fine now, not sure what was going on. I'll keep an eye on it. Thanks

The client is going to be the same for the main webpage as it is for the Arduino, and since the hosting will already be logging it, and there isn't an obvious way of doing on the Arduino... :)

The camera is going now.

I’m getting addicted to playing with your robot, unfortunately its stopped responding to web commands :frowning:

I bet he got your IP address.

Glad you're enjoying it, that's what it's there for! Bummer, looks like the ethernet shield crashed or something because the orb is still cycling. I'll be there in about an hour to reset it. I may need to do something more tricky with the pause for motor movement, maybe the ethernet chip can't keep up without being serviced...

Paul- No, I haven't got that figured that out yet ;) But you do hit on a good point. I should have stated earlier that I certainly have no evil plans in the process of identifying IPs. I was just thinking it would be a good method (short of some kind of formal log-in) to tell if there were multiple people trying to access or even locking in on one with a timeout/keep-alive. I can see how that may have come across negatively.

I bet he got your IP address.

Presently :

All you need is a court order and a meeting with Orange to get my home address :slight_smile:

If you point a browser at it, you should get my home monitoring page :

I’m confident enough of my security that you won’t get much else there. I’ll definitely get your your IP address though… :wink:

See my blue nosed Sylvester avatar ? thats hosted at the above domain so you don’t even need to visit my site, I’ll get your IP address anyway just by looking at this. If you don’t want your IP address getting out, don’t use the internet because I guarantee 99.9% of sites will be logging it.

I used to be a mod at A.N.Other forum and I used to enjoy putting forum names to IP addresses and seeing in what part of the world they lived.

@pluggy and Trav

My comment was meant to be funny. I'm sorry that it was not interpreted that way.

Paul- I did think it was funny, just wanted to clear the air for anyone that might be able to help me out. Thanks! :)

Accidently knocked over the cup, and you set it upright again after a minute or so, thanks for that! ;D Real neat project! And thank you for handing a little block ;)

It can be a little frustrating because its difficult to judge a position in 3D space from a 2D webcam view. I find turning the spotlight in the jaws on help a bit. Lots of fun though.......

Sorry PaulS, IP addresses are something of a pet subject with me. :)

I love that so many people overseas from me are enjoying it. Imahilus- glad to be of service!

The 2D thing is a problem. I've thought about adding a second camera, either from the side angle or possibly on the arm itself, just haven't invested the time or money. I'm planning to add ambient lighting control, hopefully tomorrow night, that might help make the spotlight method a little more effective...

Fantastic project.

I really loved playing with the robotic arm. Managed to lift a block and dropped it. Then tried lifting the cup over top to empty it. Left it with one green block on its side in the cup.

A huge thank you to Brett from for solving this one. He has done some work on the Ethernet library that not only makes the client IP available (my original request) but also fixes several bugs associated with the library. I was seeing the Ethernet shield lose communication all together in high traffic, but that seems to be fixed as well. Thank you so much for the help Brett! ;D

miruthanka: Thanks, but I need to get the user IP before I'd be able to look it up.

Thanks to everyone for the responses/support! :)

could you share it? I mean the source code. I'm also interested in it. thanks in advance, Mark

I’ll post it until Brett is able to release an “official” version:

Here’s a note from Brett, there also some code on the Rogue Robotics site that uses the getRemoteIP call. Thanks once again Brett!

Here’s the revised “Ethernet” library. It’s definitely not official, but I will be working on it over time. I’ll get it into a code repository soon enough and integrate all of the improvements.

To get the remote IP address, you need to call getRemoteIP() when you have the Client class from your server.available() call.


Server s;
Client c;
byte rip[4];

c = s.available();

if (c)
// rip now has 4 quads of the remote IP address }