What I am trying to do is to build a Walkie-Talkie app.
At first, I watched WWDC video introducing Network.framework and decided to use Network.framework to implement networking in my Walkie-Talkie app.
The reason I choose Network.framework is that it I was trying to implement my app's networking by socket programming, and Network.framework is introduced as modern alternative to socket programming.
After that, I decided to use Peer-to-Peer network because I wanted my app to work without any main server, and I thought P2P network fits concept of walkie-talkie(nearby communication).
To accomplish implementing P2P network using Network.framework, I found an Tic-Tac-Toe example using Peer to Peer option in Network.framework, and used it as guidance of my app.
While implementing my walkie-talkie app, I first tried to implement a real-time voice streaming using sockets, but it was too difficult to accomplish.
-> I think this is where I thought I should use UDP in my project. Because what I was trying to implement was VoIP, and UDP is ideal solution for it.
After few research, I figured out that most of Push-To-Talk apps record user's voice and sends it, not real-time streams it.
So I decided to record and send user's voice to implement Push-To-Talk, and I still thought UDP is ideal solution for it, because it is voice data I am trying to send, and I thought little loss would be okay while fast response is very important in walkie-talkie.