diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/jaegertracing/thrift/contrib/zeromq/csharp/Main.cs | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/jaegertracing/thrift/contrib/zeromq/csharp/Main.cs')
-rw-r--r-- | src/jaegertracing/thrift/contrib/zeromq/csharp/Main.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/jaegertracing/thrift/contrib/zeromq/csharp/Main.cs b/src/jaegertracing/thrift/contrib/zeromq/csharp/Main.cs new file mode 100644 index 000000000..e66cfe080 --- /dev/null +++ b/src/jaegertracing/thrift/contrib/zeromq/csharp/Main.cs @@ -0,0 +1,60 @@ +using System; +using System.Threading; +using Thrift.Protocol; +using ZMQ; +using ZmqServer; +using ZmqClient; + +namespace ZmqServer +{ + class MainClass + { + public static void Main (string[] args) + { + new Thread(Server.serve).Start(); + Client.work(); + } + + static class Server{ + public static void serve(){ + StorageHandler s=new StorageHandler(); + Storage.Processor p=new Storage.Processor(s); + + ZMQ.Context c=new ZMQ.Context(); + + TZmqServer tzs=new TZmqServer(p,c,"tcp://127.0.0.1:9090",ZMQ.SocketType.PAIR); + tzs.Serve(); + } + + class StorageHandler:Storage.Iface{ + int val=0; + + public void incr(int amount){ + val+=amount; + Console.WriteLine("incr({0})",amount); + } + + public int get(){ + return val; + } + } + } + + static class Client{ + public static void work() + { + Context ctx=new Context(); + TZmqClient tzc=new TZmqClient(ctx,"tcp://127.0.0.1:9090",SocketType.PAIR); + TBinaryProtocol p=new TBinaryProtocol(tzc); + + Storage.Client client=new Storage.Client(p); + tzc.Open(); + + Console.WriteLine(client.@get()); + client.incr(1); + client.incr(41); + Console.WriteLine(client.@get()); + } + } + } +} |