Esempio n. 1
0
        public override bool SendData(byte[] bytes, int size, Topic t)
        {
            bool result = true;

            if (this.topicSinkMap.ContainsKey(t.GetName()))
            {
                Entry_T       dict          = this.topicSinkMap[t.GetName()];
                List <string> sinksToDelete = new List <string>();

                // Loop over all sinks and send data, remove items that isn't "alive".
                foreach (KeyValuePair <string, IpPortPair> kvp in dict.portMap)
                {
                    // Check if this sink is alive
                    if (kvp.Value.IsAlive())
                    {
                        result &= SendData(bytes, size, InetAddress.GetByName(kvp.Value.Ip), kvp.Value.Port);
                    }
                    else //Remove it.
                    {
                        sinksToDelete.Add(kvp.Key);
                    }
                }
                foreach (string key in sinksToDelete)
                {
                    dict.portMap.Remove(key);
                }
            }
            return(result);
        }
Esempio n. 2
0
 public bool SendTo(byte[] bytes, int offset, int size, string ip, int port)
 {
     try
     {
         return(SendTo(bytes, offset, size, InetAddress.GetByName(ip), port));
     } catch (Exception ex)
     {
         Logger.ExceptionLogger.LogException(ex);
         return(false);
     }
 }
Esempio n. 3
0
 public bool SendTo(byte[] bytes, int offset, int size, string ip, int port)
 {
     try
     {
         return(this.SendTo(bytes, offset, size, InetAddress.GetByName(ip), port));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 4
0
 public McSendDataHandler(Topic t, string localInterface)
 {
     sender = new MulticastSender(0, localInterface, 1, t.GetOutSocketBufferSize());     // Make ttl configurable
     sinkIP = InetAddress.GetByName(t.GetDomainAddress());
 }
Esempio n. 5
0
 public TcpSendDataHandler(Topic t, string localInterface)
 {
     sender = new TcpServerSender(t.GetDomainAddress(), t.GetPort(), t.GetOutSocketBufferSize());
     sinkIP = InetAddress.GetByName(t.GetDomainAddress());
 }
Esempio n. 6
0
 public McSendDataHandler(Topic t, string localInterface, int ttl)
 {
     sender = new MulticastSender(0, localInterface, ttl, t.GetOutSocketBufferSize());
     sinkIP = InetAddress.GetByName(t.GetDomainAddress());
 }