Closed masfoobar closed 1 year ago
Additional note -- the Raspberry Pi's are using Linux. I guess this is the "next step" when I can get the above working on Windows.. on the same machine.
Thanks.
Maybe you should wait before you dispose your PushSocket to give your python code a chance to receive the message. I just extended you example code, and it works nicely. using NetMQ; using NetMQ.Sockets;
public class Issue { static void Main() {
using (var sender = new PushSocket())
{
//ForceDotNet.Force(); //<-- found this online.. needed? Makes not difference, currently
sender.Connect("tcp://127.0.0.1:5555"); //<-- also did "tcp://localhost:5555"
var str = "Hello from Windows C#";
sender.SendFrame(str);
Thread.Sleep(1000);
}
NetMQConfig.Cleanup();
}
}
Environment
Expected behaviour
I am trying to use NetMQ so our C# applications can communicate with Raspberry Pi's. Using Push-Pull sample, I can get a Python program to talk to another Python program. However, I cannot get C# (NetMQ) to talk to the Python program.
Removing Raspberry Pi's for the moment - I am testing push and pull on the same machine.
Actual behaviour
When testing push.py and pull.py -- it works as expected.
push.py
pull.py
However, when I test my C# project to communicate with pull.py, nothing is received. Here is the C# code (which would communicate with pull.py)
Steps to reproduce the behaviour
1) Testing the push.py and pull.py (works) Open Powershell (window 1)
Open another Powershell (window 2)
Window 1, everytime you execute the line in Window 2, will spit out "result is: b'Hello Windows Python!'"
2) Testing C# and pull.py (does not work) Open Powershell (window 1)
Run C# code (I do this in Visual Studio) Step through the code... nothing gets printed in Window 1 Expecting something like "Hello from Windows C#" to come out, or an error message if in wrong format.
Final notes
Please note I have tried different variations.. sending (from C#) as bytes, as well as trying recv_string or recv_json in python. Does not make any difference.
I don't think I have any confusion with the versions I am using. According to the 'Read the Docs' NetMQ should play nice with ZeroMQ, generally speaking.
Any advice or ideas -- more than welcome. Thank you.