Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- implemented ZHelpers.SetID()

- poll 10 milliseconds not 10'000 milliseconds like in the C example (see ZMQ_POLL_MSEC in http://www.zeromq.org/docs:3-1-upgrade)
  • Loading branch information...
commit 260b706eed29b369745eb19922101af1df58145a 1 parent e3b1b22
@rganz rganz authored
Showing with 5 additions and 4 deletions.
  1. +3 −1 examples/C#/ZHelpers.cs
  2. +2 −3 examples/C#/asyncsrv.cs
View
4 examples/C#/ZHelpers.cs
@@ -31,7 +31,9 @@ public static void Dump(ZmqSocket socket, Encoding encoding)
public static string SetID(ZmqSocket client, Encoding unicode)
{
- throw new NotImplementedException();
+ var str = client.GetHashCode().ToString();
+ client.Identity = unicode.GetBytes(str);
+ return str;
}
public static bool Version()
View
5 examples/C#/asyncsrv.cs
@@ -48,8 +48,7 @@ public static void ClientTask()
using (ZmqSocket client = context.CreateSocket(SocketType.DEALER))
{
// Generate printable identity for the client
- ZHelpers.SetID(client, Encoding.Unicode);
- string identity = Encoding.Unicode.GetString(client.Identity);
+ string identity = ZHelpers.SetID(client, Encoding.Unicode);
client.Connect("tcp://localhost:5570");
client.ReceiveReady += (s, e) =>
@@ -67,7 +66,7 @@ public static void ClientTask()
// Tick once per second, pulling in arriving messages
for (int centitick = 0; centitick < 100; centitick++)
{
- poller.Poll(TimeSpan.FromMilliseconds(10000));
+ poller.Poll(TimeSpan.FromMilliseconds(10));
}
var zmsg = new ZMessage("");
zmsg.StringToBody(String.Format("request: {0}", ++requestNumber));
Please sign in to comment.
Something went wrong with that request. Please try again.