On win10, a simple req/rep mode,But if the client starts first,Then start the server side.The client will not be able to send any messages.
nqf opened this issue · comments
nqf commented
It seems that connect can't try to connect to the server.Here is my test demo.
client:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using ZeroMQ;
namespace Examples
{
static partial class Program
{
static public void Main ()
{
string endpoint = "tcp://127.0.0.1:5555";
// Create
using (var context = new ZContext())
using (var requester = new ZSocket(context, ZSocketType.REQ))
{
// Connect
requester.Connect(endpoint);
Console.Write("sleep\n");
Thread.Sleep(10000);
Console.Write("sleep endpoint\n");
for (int n = 0; n < 10; ++n)
{
string requestText = "Hello";
Console.Write("Sending {0}...", requestText);
// Send
requester.Send(new ZFrame(requestText));
// Receive
using (ZFrame reply = requester.ReceiveFrame())
{
Console.WriteLine(" Received: {0} {1}!", requestText, reply.ReadString());
}
}
}
}
}
}
server:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using ZeroMQ;
namespace Examples
{
static class Program
{
static public void Main ()
{
string name = "hello";
// Create
using (var context = new ZContext())
using (var responder = new ZSocket(context, ZSocketType.REP))
{
// Bind
responder.Bind("tcp://*:5555");
while (true)
{
// Receive
using (ZFrame request = responder.ReceiveFrame())
{
Console.WriteLine("Received {0}", request.ReadString());
// Do some work
Thread.Sleep(1);
// Send
responder.Send(new ZFrame(name));
}
}
}
}
}
}```