Need advice: UDP? TCP? Multithread? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: Need advice: UDP? TCP? Multithread? (/thread-3061.html) |
Need advice: UDP? TCP? Multithread? - Guybrush - Apr-27-2017 Hi all! I need some advice for a software that I need to do... I've 6-8 Cameras( intel realsense) in a room. Every camera calculate the contours of the objects in the scene (with opencv - findcontours) in a big while cycle and send it (as a string) to this software that I need to do. (a lot of messages every second) This software that I need to do read the messages (every cycle from a different camera), draws the contours in a section of a big image that represent the room. Every cycle that software performs an objects tracking on this "room". I tried to use UDP socket for the connection but it seams to slow down when more then 2 cameras are in the room. What do you suggest? a multithread TCP connection? Can you give me some documentation (or example) that can help me? Another question. The content of the message is the result of find contours. It's a very long string. Do you know any better method than this? Thank you very much and sorry for my english ;) RE: Need advice: UDP? TCP? Multithread? - nilamo - Apr-27-2017 How are you receiving messages? Are you just binding to a port and handling it manually? Have you tried using Twisted to handle the networking? RE: Need advice: UDP? TCP? Multithread? - Guybrush - Apr-28-2017 (Apr-27-2017, 05:47 PM)nilamo Wrote: How are you receiving messages? Are you just binding to a port and handling it manually? Have you tried using Twisted to handle the networking? hi, thank you for the reply! Yes, I'm binding to a port in a single process. So wherever the message comes, I process it. This is not ideal. I don't know Twisted, I'll take a look. Have you some documentation to suggest? RE: Need advice: UDP? TCP? Multithread? - nilamo - Apr-28-2017 I don't have a lot of experience with Twisted (I really want to change that, though, it looks like it can help with many of the things I do lol), and I especially have no experience at all with it's UDP. But the main docs look pretty good: https://twistedmatrix.com/documents/current/core/howto/udp.html RE: Need advice: UDP? TCP? Multithread? - Guybrush - Apr-28-2017 (Apr-28-2017, 03:14 PM)nilamo Wrote: I don't have a lot of experience with Twisted (I really want to change that, though, it looks like it can help with many of the things I do lol), and I especially have no experience at all with it's UDP. But the main docs look pretty good: https://twistedmatrix.com/documents/current/core/howto/udp.html Thank you very much! I'll try to understand something these days! RE: Need advice: UDP? TCP? Multithread? - wavic - Apr-28-2017 Twisted... See this. It's a simple enough and is a good starting point. Also, you may try asyncio module. https://docs.python.org/3.5/library/asyncio-stream.html |