Exemple #1
0
        public int FanOutClientGetData(string name, out string odata)
        {
            //now now
            if (FanoutClientRM.ContainsKey(name))
            {
                FanoutClientRun rr = FanoutClientRM[name];
                odata = string.Empty;
                odata = rr.pullsock.ReceiveFrameString();

                if (odata == null)
                {
                    return(-1);
                }
            }
            else
            {
                odata = string.Empty;
                return(-1);
            }
            return(0);
        }
Exemple #2
0
        public int FanOutClientService()
        {
            if (ModFanOutClients != null)
            {
                foreach (Point p in ModFanOutClients)
                {
                    if (FanoutClientRM.ContainsKey(p.name))
                    {
                        Logging.logger.Warn("The fanout clisnt is exist " + p.name);
                    }
                    else
                    {
                        FanoutClientRun rr = new FanoutClientRun();
                        PullSocket      r  = new PullSocket();

                        string e = "tcp://" + p.ip + ":" + p.port;
                        try
                        {
                            r.Connect(e);
                            rr.name     = p.name;
                            rr.point    = p;
                            rr.pullsock = r;
                            rr.Running  = true;
                            rr.Working  = false;
                        }
                        catch (Exception err)
                        {
                            Logging.logger.Error(ModName + " connect push socket failed " + e + " " + err.Message);
                            throw (err);
                        }

                        FanoutClientRM.Add(p.name, rr);
                    }
                }
            }
            return(0);
        }