The dedicated server would be a lobby where all the players connect and find matches. Once a match is found the server hooks to two players and sends them off on a p2p network. Once the match is over, the players would reconnect to the lobby to find a new match. Is this a viable approach? Or does WiFi not handle P2P under any wide band situations (unlike Wifi direct (very local) or bluetooth (extremely close))?
As far as trying it out, I attempted to record an ip address and port number at the server and send that information in a packet to my other mobile device. Once the client A "had" client b's address + port, and vise versa, I assumed I could send messages, but that didn't really seem to work.
I'm using java NIO, so it would look something like this (pseudo):
Client A creates a datagram channel and set it to non blocking
Send connection request message to the server using the datagram channels send function
Server receives request and routes the address to the first available client, Client B (already connected and waiting)
Server sends Client A's address, to Client B's address and vise versa
Each client rebinds there datagram channel to the new address
Client A and B should be able to send messages to each other (this though did not seem to work)