Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Socket programming (TCP vs. UDP)

I'm planning to design a server that receives data from multiple clients, the server don't need to send anything back to the client, though STATUS_OK is still cool but not necessary.

I know the basics of Python socket module, twisted framework but my question is, should i use UDP or TCP? The client that need to stay connected at all.

I hope you guys understand my question, thank you for your wonderful help here

like image 591
elf1984 Avatar asked Oct 17 '25 19:10

elf1984


2 Answers

You should always use TCP until you have a performance problem that you know can be mitigated with UDP. TCP is easier to understand when it fails.

like image 119
Glyph Avatar answered Oct 20 '25 08:10

Glyph


Can you afford to lose messages? If yes, use UDP. Otherwise use TCP. It's what they're designed for.

like image 37
Brendan Long Avatar answered Oct 20 '25 07:10

Brendan Long