Exemplo n.º 1
0
 public static bool SendMessage(string packet, string upl, string Networkname)
 {
     if (packet != "")
     {
         for (int i = 0; i < 1; i++)
         {
             IInterProcessConnection clientConnection = null;
             try
             {
                 clientConnection = new ClientPipeConnection(upl, Networkname);
                 clientConnection.Connect();
                 clientConnection.Write(packet);
                 IPDTPApplication.ChatHistory.Add(clientConnection.Read());
                 Log.LWrite("Packet Sent From Default Server (upl://128.215.52)" + " || To " + upl + " || In Machine (" + Networkname + ")");
                 clientConnection.Close();
                 return(true);
             }
             catch (Exception ex)
             {
                 clientConnection.Dispose();
                 throw (ex);
             }
         }
     }
     else
     {
     }
     return(false);
 }
Exemplo n.º 2
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     if (textBox1.Text != "")
     {
         DateTime dt = DateTime.Now;
         // This cycle is used only when you want to run numerous name pipes requests
         // and measure the performance. In the general case it is not needed.
         for (int i = 0; i < 1; i++)
         {
             IInterProcessConnection clientConnection = null;
             try {
                 clientConnection = new ClientPipeConnection("MyPipe", ".");
                 clientConnection.Connect();
                 clientConnection.Write(textBox1.Text);
                 Activity.AppendText(clientConnection.Read() + Environment.NewLine);
                 clientConnection.Close();
             }
             catch (Exception ex) {
                 clientConnection.Dispose();
                 throw (ex);
             }
         }
         this.duration.Text = DateTime.Now.Subtract(dt).Milliseconds.ToString();
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            string key = "";

            while ((key = Console.ReadLine()) != "exit")
            {
                if (key != "")
                {
                    DateTime dt = DateTime.Now;
                    // This cycle is used only when you want to run numerous name pipes requests
                    // and measure the performance. In the general case it is not needed.
                    for (int i = 0; i < 1; i++)
                    {
                        IInterProcessConnection clientConnection = null;
                        try
                        {
                            clientConnection = new ClientPipeConnection("MyPipe", ".");
                            clientConnection.Connect();

                            clientConnection.Write(key);
                            Console.WriteLine(clientConnection.Read());
                            clientConnection.Close();
                        }
                        catch (Exception ex)
                        {
                            clientConnection.Dispose();
                            throw (ex);
                        }
                    }
                    Console.WriteLine(DateTime.Now.Subtract(dt).Milliseconds.ToString());
                }
            }
        }
Exemplo n.º 4
0
        static string connectSendMsg(string msg)
        {
            string retMsg = "";
            IInterProcessConnection clientConnection = null;

            try
            {
                clientConnection = new ClientPipeConnection(mXFSPipeName, ".");
                clientConnection.Connect();
                clientConnection.Write(msg);
                retMsg = clientConnection.Read() + "\n";
                clientConnection.Close();
            }
            catch (Exception ex)
            {
                clientConnection.Dispose();
                throw (ex);
            }
            return(retMsg);
        }