Using the Yun as a router

Hello,
I have a sketch that I wrote for a Uno with an ethernet shield that uses a standalone router to communicate with an ipad/iphone. It works well.

The ipad accesses the ip address of the ethernet shield (host) and exchanges commands using the Z_OSC library. I use an OSC interpreter app on my ipad to send and receive information to control various bits of hardware connected to the arduino uno or mega.

I think I should be able to do this with a YUN. Is there anything I need to do to get the Linux part of the YUN to route commands from the ipad to the arduino (and vice verse).

In my Uno sketch, I simply need to input the correct Mac address and suitable IP address for the ethernet shield and the IP address of the ipad. I use the external wireless router which is connected by cable to the ethernet shield to communicate between the ipad and ethernet shield.

For example, the following information is necessary in the sketch:

byte myMac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x89, 0x46 }; // Mac address of the Arduino ethernet shield
byte myIp[] = { 192,168,1,103 }; // IP address of the ethernet shield. This is set programatically but must match settings available from router
int serverPort = 4444; // this should be the same as the outgoing port on Ipad OSc setup
byte destIp[] = { 192, 168, 1, 100 }; // ip address of ipad

int destPort = 9000; // this should be the same as the incoming port on Ipad OSc setup

Would the YUN automatically link the ipad and the arduino or would I have to set up the YUN to act as a router?
Hope this makes sense.
Thanks,
Nick

Hi Nick,

YunClient and YunServer can be used as a drop-in replacement for EthernetClient and EthernetServer.

You can't set the mac address through the sketch as you can do with the Ethernet Shield. If your setup really needs that too you should be able to change it from the linux console using commands like "ifconfig" or "iwconfig" (I don't remember the exact syntax right now...).

Let me know if this works for you.

Just a quick follow up to my own post...
Using the Yun as a router is not really a problem as far as I can see. My difficulty in getting my project to work on a YUN is that I have previously used the Z_OSC library and I think this uses UDP rather than TCPIP.

So I will wait until someone kindly implements UDP on the YUN.
NickH