How to transfer data between two devices using WIFI-Direct?

I want to write a chat application which uses WIFI-Direct only and there are no internet or routers at all.

I've created a Wi-Fi P2P Application which can see other devices with enabled WIFI-Direct. The android guides are here : Wi-Fi Peer-to-Peer

Two devices connects to each other with WIFI-Direct and the specifications of connected device will be shown in my app.

At this point, I don't know what is the best way to transfer data between this two devices? Socket programming or what else ways are there to do this?

For Socket programming paradigm, the data flow will be from client to server only, how to transfer data in both directions?