Ejemplo n.º 1
0
        void startServer()
        {
            String dir       = "..\\..\\..\\Release\\";
            String clientExe = (dir + "TestFastIPCClient.exe");

            //System.out.println("客户端可执行文件 = " + clientExe.getAbsolutePath());
            if (!File.Exists(clientExe))
            {
                throw new Exception("客户端可执行文件[" + clientExe + "]不存在");
            }
            //initDLL(dir);
            this.server     = new FastIPCServer();
            this.serverName = FastIPCNative.genServerName();
            //System.out.println("serverName = " + serverName);
            this.blockSize = 5;
            server.create(serverName, blockSize);
            server.setListener(new MYReadListener(this));

            Thread th = new Thread(new ThreadStart(__startIPCServer)); //也可简写为new Thread(ThreadMethod);

            th.Start();                                                //启动线程

            ProcessStartInfo process = new ProcessStartInfo();

            process.FileName  = Path.GetFullPath(clientExe);
            process.Arguments = " " + serverName + " " + blockSize;

            process.UseShellExecute = false;
            process.CreateNoWindow  = true;

            process.RedirectStandardOutput = true;
            Process.Start(process);

            // string Result = p.StandardOutput.ReadToEnd();// 这里会造成线程等待
        }
Ejemplo n.º 2
0
        void startServer()
        {
            String dir = "..\\..\\..\\Release\\";
            String clientExe = (dir + "TestFastIPCClient.exe");
            //System.out.println("�ͻ��˿�ִ���ļ� = " + clientExe.getAbsolutePath());
            if (!File.Exists(clientExe)) {
                throw new Exception("�ͻ��˿�ִ���ļ�[" + clientExe + "]������");
            }
            //initDLL(dir);
            this.server = new FastIPCServer();
            this.serverName = FastIPCNative.genServerName();
            //System.out.println("serverName = " + serverName);
            this.blockSize = 5;
            server.create(serverName, blockSize);
            server.setListener(new MYReadListener(this));

            Thread th = new Thread(new ThreadStart(__startIPCServer)); //Ҳ�ɼ�дΪnew Thread(ThreadMethod);
            th.Start(); //����߳�

            ProcessStartInfo process = new ProcessStartInfo();
            process.FileName = Path.GetFullPath(clientExe);
            process.Arguments = " " + serverName + " " + blockSize;

            process.UseShellExecute = false;
            process.CreateNoWindow = true;

            process.RedirectStandardOutput = true;
            Process.Start(process);

            // string Result = p.StandardOutput.ReadToEnd();// ���������̵߳ȴ�
        }