How to conect two devices in large distance?

I want to comunicate two devices wirelessly in Android, without server. I thougth that wifip2p could be the solution but it seems that it doesn´t work in, for example a distance of 5 kilometres and I need do that. Is any posibility to do that with wifip2p or something like that?