Communication Arduino wifi to Arduino wifi

Hi guys,

Please, how can I send data wirelessly via wifi (not BT) between one Arduino to Another?
I have two Arduino Mega and two wifi modules (NRF24L01 or ESP8266 Esp-05, both of them twice, does not matter which one to use). I need to send e.g. “Hello world” from one to another and does not matter which one will be client and which AP. Or is there any other options to send it via wifi without AP? I need it send without any third AP or any another wifi network. I need to use just Arduinos.

Is it possible or it is necessary to use Arduino Yun? In this case, how can i do it with Arduino Yun?
Or is there any other available wireless technology for long range (about 500m) to use?
Thx a lot guys. Regards

You can use the Radiohead library with the NRFL01's. Look at the example sketches that come with it.