0
方案:我能發送字符串類型的使用下面的代碼從C#中的Node.js應用程序通過ZeroMQ(ØMQ)數據:
C#推代碼:無法從ZeroMQ接收確認(ØMQ)
using (var context = new Context(1))
{
using (Socket client = context.Socket(SocketType.PUSH))
{
client.Connect("tcp://127.0.0.1:12345");
int i = 0;
while (true)
{
string request = i.ToString() + "_Hello_ ";
i++;
Console.WriteLine("Sending request..." + i.ToString());
client.Send(request, Encoding.Unicode);
// <== Here is the issues
string reply = client.Recv(Encoding.Unicode).ToString();
// <== Here is the issues
Console.WriteLine("Received reply :", reply);
}
}
}
Node.js的拉碼:
pull_socket.bindSync('tcp://127.0.0.1:12345')
pull_socket.on('message', function (data) {
i++;
console.log(i.toString() + 'received data:\n');
console.log(data.toString());
pull_socket.send('rcvd'); // <== Here is the issues
});
問題:在C#reply
對象將包含字符串"Not supported"
,但發送的數據將在Node.js正確接收。
問題:可以告訴我我在哪裏做錯了嗎?請說明問題。
高級感謝