Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More C# examples fixed #296

Merged
merged 1 commit into from Feb 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/C#/ZHelpers.cs
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions examples/C#/asyncsrv.cs
Expand Up @@ -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) =>
Expand All @@ -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));
Expand Down