シナリオ: 次のコードを使用して、ZeroMQ (ØMQ) を介して C# から Node.JS アプリに文字列型のデータを送信できます:
C# プッシュ コード:
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
オブジェクトには string が含まれます"Not supported"
が、送信されたデータは Node.js で正しく受信されます。
質問: どこが間違っているのか教えてもらえますか? 問題に光を当ててください。
高度な感謝