Question: I am facing a problem regarding designing my app with datagram socket. My app needs to communicate with different servers using udp connections. now I am not sure which of the following will be good. Is there any advantage of any of the following ( by performance or by other measures ). or is there any better option?

**Option 1**

create a single Datagram socket, and create a single thread to receive data of that. While sending to different servers set the address of the datagram packets. and in the receiving thread check the address and process data accordingly

**Option 2**

create different datagram sockets to communicate with servers. use `socket.connet()` to connect to the relevant server. And create threads for every socket to receive data.

**N.B.** I am actually working on an android app. if you have any query you can ask in comment

Answer: 
Unless you are we are talking about 100000 of connections, I would create single socket per thread. It speeds up application and guarantee the thread safety of sockets and that receaved data wont get mixed up. 
The most important is however, that if one channel will fail or latency will get high, it will have no influence on other channels (sockets).

The drawback is that you are consuming more resources.
All depends on purpose of app.
My opinion is you can create a single socket to because creating more socket will bring down your app.