02-28-2024 08:40 AM
Hi! I currently have an assignment that requires me to create a security system, which is almost the same as this video. Around the 29:30 min mark, you can see the LED change colours immediately when he clicks the buttons.
I followed what he did in the block diagram but couldn't replicate his results. What might be the problem here?
I'm thinking its because every time it loops, TCP read has to wait for TCP write to send data to it hence the delay, but if this was the case, wouldn't the video also have the delay too?
Solved! Go to Solution.
02-28-2024 08:49 AM
@koga3z wrote:
you can see the LED change colours immediately when he clicks the buttons.
I followed what he did in the block diagram but couldn't replicate his results. What might be the problem here?
I'm thinking its because every time it loops, TCP read has to wait for TCP write to send data to it hence the delay, but if this was the case, wouldn't the video also have the delay too?
Yes, the TCP Read will wait, but I don't see significant delays (well, you have 100 ms sleeps, but no larger delays noticed), this is how it works for me:
02-28-2024 08:52 AM - edited 02-28-2024 08:53 AM
@Andrey_Dmitriev wrote:
@koga3z wrote:
you can see the LED change colours immediately when he clicks the buttons.
I followed what he did in the block diagram but couldn't replicate his results. What might be the problem here?
I'm thinking its because every time it loops, TCP read has to wait for TCP write to send data to it hence the delay, but if this was the case, wouldn't the video also have the delay too?
Yes, the TCP Read will wait, but I don't see significant delays (well, you have 100 ms sleeps, but no larger delays noticed), this is how it works for me:
Hmm, that is weird. Do you have any idea what might cause a delay of up to 5 seconds on my side?
It was working normally yesterday, but now the thing just... I don't know what to say about this.
02-28-2024 08:57 AM
@koga3z wrote:
It was working normally yesterday, but now the thing just... I don't know what to say about this.
As stupid suggestion - may be you have highlight execution active on BD?
02-28-2024 08:59 AM
Hey Andrey,
I just found out the reason why there's a delay on my side, it's because I had the block diagram on while running my front panel, causing the huge delay...
Thanks for your help anyways 🙂
02-28-2024 09:02 AM
@Andrey_Dmitriev wrote:As stupid suggestion - may be you have highlight execution active on BD?
Did some more "debugging" around, and I found out it was this thing's problem! TIL haha... Will keep it in mind next time
02-28-2024 01:09 PM - edited 02-28-2024 01:11 PM
For some general comments here are some potential simplifications.
Note that (for simplicity) I replace the TCP with a simple notifier, retaining the string type as message. I would strongly recommend to use UDP instead of TCP. A stateless connection is much less overhead!
02-28-2024 01:23 PM
@altenbach wrote:
I would strongly recommend to use UDP instead of TCP. A stateless connection is much less overhead!
Here's how that could look like....
(Of course typically the two loops would run on different machines (else we would not need any network protocol!) and changes need to be made. Have a look at the UDP example in the example finder.)