示例#1
0
 /// <summary>
 /// stop consuming/receiving data
 /// </summary>
 /// <returns></returns>
 public bool StopConsuming()
 {
     try
     {
         Client.Close();
         Client    = null;
         Consumer  = null;
         Consuming = false;
         return(true);
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
     return(false);
 }
示例#2
0
 /// <summary>
 /// stop consuming/receiving data
 /// </summary>
 /// <returns></returns>
 public bool StopConsuming()
 {
     try
     {
         Client.Close();
         Client = null;
         Consumer = null;
         Consuming = false;
         return true;
     }
     catch(Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
     return false;
 }
示例#3
0
 /// <summary>
 /// start conuming/recieving data
 /// </summary>
 /// <param name="port"></param>
 /// <param name="consumer"></param>
 /// <returns></returns>
 public bool StartConsuming(int port, INetComConsumer consumer)
 {
     try
     {
         Consumer            = consumer;
         Client              = new UdpClient(port);
         Client.DontFragment = true;
         Client.BeginReceive(new AsyncCallback(ReceivePacket), null);
         Consuming = true;
         return(true);
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
     return(false);
 }
示例#4
0
 /// <summary>
 /// start conuming/recieving data
 /// </summary>
 /// <param name="port"></param>
 /// <param name="consumer"></param>
 /// <returns></returns>
 public bool StartConsuming(int port, INetComConsumer consumer)
 {
     try
     {
         Consumer = consumer;
         Client = new UdpClient(port);
         Client.DontFragment = true;
         Client.BeginReceive(new AsyncCallback(ReceivePacket), null);
         Consuming = true;
         return true;
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
     return false;
 }
示例#5
0
 /// <summary>
 /// start conuming/recieving data
 /// </summary>
 /// <param name="port"></param>
 /// <param name="consumer"></param>
 /// <returns></returns>
 public bool StartConsuming(int port, INetComConsumer consumer)
 {
     //try
     //{
     //    Consumer = consumer;
     //    Client = new TcpClient(port);
     //    Client.DontFragment = true;
     //    Client.BeginReceive(new AsyncCallback(ReceivePacket), null);
     //    Consuming = true;
     //    return true;
     //}
     //catch (Exception ex)
     //{
     //    Trace.WriteLine(ex.ToString());
     //}
     return(false);
 }
示例#6
0
 /// <summary>
 /// start conuming/recieving data
 /// </summary>
 /// <param name="port"></param>
 /// <param name="consumer"></param>
 /// <returns></returns>
 public bool StartConsuming(int port, INetComConsumer consumer)
 {
     //try
     //{
     //    Consumer = consumer;
     //    Client = new TcpClient(port);
     //    Client.DontFragment = true;
     //    Client.BeginReceive(new AsyncCallback(ReceivePacket), null);
     //    Consuming = true;
     //    return true;
     //}
     //catch (Exception ex)
     //{
     //    Trace.WriteLine(ex.ToString());
     //}
     return false;
 }
示例#7
0
 public bool StartConsuming(int port, INetComConsumer consumer)
 {
     try
     {
         if (Consuming)
             return false;
         eventStop.Reset();
         PortSubscribe = port;
         threadMessaging = new Thread(new ThreadStart(ZMQReceiver));
         threadMessaging.Start();
         Consuming = true;
         return true;
     }
     catch (System.Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
     return false;
 }
示例#8
0
 public bool StartConsuming(int port, INetComConsumer consumer)
 {
     try
     {
         if (Consuming)
         {
             return(false);
         }
         eventStop.Reset();
         PortSubscribe   = port;
         threadMessaging = new Thread(new ThreadStart(ZMQReceiver));
         threadMessaging.Start();
         Consuming = true;
         return(true);
     }
     catch (System.Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
     return(false);
 }
示例#9
0
 public bool StartConsuming(INetComConsumer consumer)
 {
     return StartConsuming(PortSubscribe, consumer);
 }
示例#10
0
 /// <summary>
 /// start consuming/receiving data with internal port
 /// </summary>
 /// <param name="consumer"></param>
 /// <returns></returns>
 public bool StartConsuming(INetComConsumer consumer)
 {
     return(StartConsuming(PortIn, consumer));
 }
示例#11
0
 public bool StartConsuming(INetComConsumer consumer)
 {
     return(StartConsuming(PortSubscribe, consumer));
 }
示例#12
0
 /// <summary>
 /// start consuming/receiving data with internal port
 /// </summary>
 /// <param name="consumer"></param>
 /// <returns></returns>
 public bool StartConsuming(INetComConsumer consumer)
 {
     return StartConsuming(PortIn, consumer);
 }