Python Forum
Need advice: UDP? TCP? Multithread?
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need advice: UDP? TCP? Multithread?
#1
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 ;)
Reply
#2
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?
Reply
#3
(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?
Reply
#4
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/curr...o/udp.html
Reply
#5
(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/curr...o/udp.html

Thank you very much! I'll try to understand something these days!
Reply
#6
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
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multithread telnet not working Parallel anna 7 7,356 Feb-05-2018, 01:17 PM
Last Post: anna

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020