Objective is click of button should start populating textbox with strings received from python script. In debug stepping I get to see the strings being received in "var message". But by virtue of while(true)
, the GUI freezes and one never gets to see textbox contents.
Tried Backgroundworker, but it throws exception for no access to richTextBox2.
private void button4_Click(object sender, EventArgs e)
{
using (var context = ZmqContext.Create())
{
using (ZmqSocket SubscriberSocket = context.CreateSocket(SocketType.SUB))
{
SubscriberSocket.Subscribe(Encoding.UTF8.GetBytes("220.20"));
SubscriberSocket.Connect("tcp://127.0.0.1:5000");
while(true)
{
var message = SubscriberSocket.Receive(Encoding.UTF8);
richTextBox2.Text += message + '\n';
}
}
}
}