public ReqReplyServiceSpecs() { Reply = string.Empty; Replied = new ManualResetEvent(false); Console.WriteLine("Start client fiber"); ClientFiber = PoolFiber.StartNew(); ClientContext = NetMQContext.Create(); ServerFiber = PoolFiber.StartNew(); ServerContext = NetMQContext.Create(); Func<byte[], string> unmarshaller = x => Encoding.Unicode.GetString(x); Func<string, byte[]> marshaller = x => Encoding.Unicode.GetBytes(x); Service = new RequestHandlerSocket<string, string>(ServerContext, "tcp://Monster:9997", unmarshaller, marshaller); Service.SetRequestHandler(ServerFiber, request => request.Reply(request.Request.ToUpper())); Console.WriteLine("Start service"); Client = new RequestSocket<string, string>(ClientContext, "tcp://Monster:9997", marshaller, unmarshaller); Console.WriteLine("Start client"); }
public ReqReplyServiceSpecs() { Reply = string.Empty; Replied = new ManualResetEvent(false); Console.WriteLine("Start client fiber"); ClientFiber = PoolFiber.StartNew(); ClientContext = NetMQContext.Create(); ServerFiber = PoolFiber.StartNew(); ServerContext = NetMQContext.Create(); Func <byte[], string> unmarshaller = x => Encoding.Unicode.GetString(x); Func <string, byte[]> marshaller = x => Encoding.Unicode.GetBytes(x); Service = new RequestHandlerSocket <string, string>(ServerContext, "tcp://Monster:9997", unmarshaller, marshaller); Service.SetRequestHandler(ServerFiber, request => request.Reply(request.Request.ToUpper())); Console.WriteLine("Start service"); Client = new RequestSocket <string, string>(ClientContext, "tcp://Monster:9997", marshaller, unmarshaller); Console.WriteLine("Start client"); }