コード例 #1
0
ファイル: ServiceManager.cs プロジェクト: dsjzazs/Tomato
 public static void Initialize()
 {
     RegisterService_REP.Bind(ServerAddress.RegisterServiceAddress);
     RegisterService_REP.ReceiveReady += RegisterService_REP_ReceiveReady;
     Poller.Add(RegisterService_REP);
     Poller.RunAsync();
 }
コード例 #2
0
        private void dataServer()
        {
            NetMQContext ctx = NetMQContext.Create();

            NetMQ.Sockets.ResponseSocket dataSender = ctx.CreateResponseSocket();
            dataSender.Bind("tcp://*:5565");
            Debug.Log("Enter while.. ");

            while (isRunning)
            {
                string message = dataSender.ReceiveString();
                print("Got request message: " + message);

                // re-run scene iteration if true
                if (doGatherOnRequest)
                {
                    gatherSceneData();
                }

                switch (message)
                {
                case "header":
                    print("Send Header.. ");
                    dataSender.Send(headerByteData);
                    print(string.Format(".. Nodes ({0} bytes) sent ", headerByteData.Length));
                    break;

                case "nodes":
                    print("Send Nodes.. ");
                    dataSender.Send(nodesByteData);
                    print(string.Format(".. Nodes ({0} bytes) sent ", nodesByteData.Length));
                    break;

                case "objects":
                    print("Send Objects.. ");
                    dataSender.Send(objectsByteData);
                    print(string.Format(".. Objects ({0} bytes) sent ", objectsByteData.Length));
                    break;

                case "textures":
                    print("Send Textures.. ");
                    dataSender.Send(texturesByteData);
                    print(string.Format(".. Textures ({0} bytes) sent ", texturesByteData.Length));
                    break;

                default:
                    break;
                }
            }

            dataSender.Unbind("tcp://127.0.0.1:5565");
            dataSender.Close();
        }