How to receive data via udp stream

Hi all,
how can I receive udp stream.
If I use a while loop the udp socket blocks till the sender send data and rhino crash before.
I can use select with timeout to check if the sender sends data or not.

Some hints are very welcome

Hi, you tried to download the ghowl examples, I left the link attached to you.


There is an example titled gHowl_UDP_send+receive.

Thanks for the link , but I want to understand how I can use python to create a udp socket.
My only problem is that rhino freeze because the socket inside the while loop block until it receive data.
I guess threating is a option but I try to avoid it.
Another option is maybe the timer but it rerun the whole component.
Maybe there is a option to use the timer only for a part of a script.

You basically found the answer to your problem yourself. All you need to do is to handle it asynchron. There are multiple ways in achiving this. You could use the System.Timers.Timer and hook to the elapsed event, You could create custom thread which invokes a change in the GUI thread or simply work with custom events… There are dozens of options, but all deal with multithreading. Maybe you start to learn about this topic, since its quite a important skill any programmer should have…

Thanks for the tip to search for