HELP!! How to using this scheme Arduino---router---internet---router---Arduino

Hello, I have 2 Arduino mega and 2 w5100 ethernet shield, i want both arduino can communication via internet using ethernet shield and wifi router, each example if I push the button at first arduino, the second arduino led will ON, but i have stuck with UDp ethernet send receive didn't work ,anyone have an example?
from ethernet shield to router i use straight LAN cable Cat 6. Thank You

With the ethernet shield, the Arduino can act as a client, making requests to servers, or it can act as a server, handling requests from clients.

Which role should each of your Arduinos perform? When you have that sorted out, making the client make a GET request, to have a server turn on an LED, is trivial, as is handling the request on the server.

PaulS:
With the ethernet shield, the Arduino can act as a client, making requests to servers, or it can act as a server, handling requests from clients.

Which role should each of your Arduinos perform? When you have that sorted out, making the client make a GET request, to have a server turn on an LED, is trivial, as is handling the request on the server.

Oke, I have change my role to my arduino to be (arduino+ethernet shield w5100) --- LAN Cable --- (arduino+ethernet shield w5100) for simple arduino to arduino communication ( example if I push the button at first arduino, the second arduino led will ON)

I use UDP Send Receive example, but the task can't perform like i want.

I attach UDPSendReceiveString.ino i confused to change the program, because i'm newbie with arduino programming

Can You help me? Thank You

UDPSendReceiveString.ino (2.96 KB)

I use UDP Send Receive example, but the task can't perform like i want.

The code does something. You failed to describe what it actually does.

You expect the code to do something. All that hand-waving your are doing is pretty, but useless. FACTS are useful.