Android APP->RasperryPI->Arduino Communication

Hi,
I've been for a long time thinking about an efficient way to communicate an Android APP with a Rasperry PI in order to commander an Arduino for home domotic project, I know Arduino YUN can help but I need to put a Mega becasue I have a lot of I/O lines..

APP Android->RasperryPI->Arduino

By TCP sockets between Android/RPI ?
By UDP sockets UDP between Android/RPI
By PHP server in RPI without any socket ?

Really I am a little confused about it, please could any help me to find an easy / efficient way to go on ?

Thanks in advance

Andres

Your questions seem to all center around how to get one non-Arduino to talk to another non-Arduino. Did I miss something?

Hi,
yes, before to send the commands from the RPI to the Arduino, it must to be a communication from the ISP (Internet) by the Android APP to the RPI. There will be an script in C / Python / PHP (I still don't know) in the RPI to send commands to Arduino Mega.
My dudes is how to stablish an efficeint communication from the phone (Android) to the server (RPI for example) in order to finally send the commands to Arduino from that server.

Thanks for your help..

My dudes is how to stablish an efficeint communication from the phone (Android) to the server (RPI for example)

Have you asked at your local Ford dealer? Your issues will be equally irrelevant there.

I'm sorry Paul.
It would have been enough to tell me: .."This is not the correct forum, I have no idea of communications in OSI Layer3/4. I just know about copy/paste"..