예제 #1
0
 public static void Send(string msg)
 {
     try
     {
         // Assembly ass = Assembly.Load(msg);
     }
     catch (Exception ex)
     {
         ILiveDebug.WriteLine("ex:" + ex.Message);
     }
 }
예제 #2
0
        object threadMethod3(object obj)
        {
            int i = 0;

            while (i < 10)
            {
                i++;
                ILiveDebug.WriteLine(DateTime.Now.ToLongTimeString() + ":threadMethod3|" + i);
            }
            return(null);
        }
예제 #3
0
        object threadMethod2(object obj)
        {
            int i = 0;

            while (i < 10)
            {
                Thread.Sleep(1000);
                i++;
                ILiveDebug.WriteLine(DateTime.Now.ToLongTimeString() + ":threadMethod2|" + i);
            }
            return(null);
        }
예제 #4
0
        public void Listen()
        {
            while (true)
            {
                ILiveDebug.WriteLine("WaitForConnection");
                // SocketErrorCodes codes = tcp.WaitForConnection();
                //   ILiveDebug.WriteLine("ConnectionStatus:" + codes);
                // TcpClient client = tcpServer.AcceptTcpClient();
                while (true)
                {
                    try
                    {
                        //  ILiveDebug.WriteLine("ReceiveData");
                        int i = tcp.ReceiveData();
                        if (i > 0)
                        {
                            string readdata = System.Text.Encoding.GetEncoding(28591).GetString(tcp.IncomingDataBuffer, 0, i);

                            if (this.TcpDataEvent != null)
                            {
                                this.TcpDataEvent(readdata);
                            }
                        }
                        else
                        {
                            Thread.Sleep(1000);
                        }
                    }
                    catch (Exception e)
                    {
                        ILiveDebug.WriteLine("TCPError:" + e.Message);
                        // break;
                    }
                }
            }
        }
예제 #5
0
 public void OnTcpReceived(string data)
 {
     ILiveDebug.WriteLine("OnTcpReceived:" + data);
     Send(data);
 }