示例#1
0
        public static void RunAsClient(object ip_addr_port_var)
        {
            IpAddrPort ip_addr_port = (IpAddrPort)ip_addr_port_var;

            Getac.Csc.Utilities.Ipc.IpcBaseClass ipc_base = new Getac.Csc.Utilities.Ipc.IpcBaseClass();
            Getac.Csc.Utilities.Ipc.IpcApiClass  ipc_api  = ipc_base.IpcApi();

            int path_id = ipc_api.ApiTcpClient(ip_addr_port.IpAddr, ip_addr_port.Port);

            if (path_id == -1)
            {
                Utilities.DebugClass.DebugIt("TestClient", "***** path_id == -1");
                return;
            }

            Thread.Sleep(1000);
            for (int i = 0; i < 5; i++)
            {
                ipc_api.ApiTcpTransmitData(path_id, "hello from phwang");
            }
        }
示例#2
0
        public static void RunAsServer(object ip_addr_port_var)
        {
            IpAddrPort ip_addr_port = (IpAddrPort)ip_addr_port_var;

            Getac.Csc.Utilities.Ipc.IpcBaseClass ipc_base = new Getac.Csc.Utilities.Ipc.IpcBaseClass();
            Getac.Csc.Utilities.Ipc.IpcApiClass  ipc_api  = ipc_base.IpcApi();

            int path_id = ipc_api.ApiTcpServer(ip_addr_port.IpAddr, ip_addr_port.Port);

            if (path_id == -1)
            {
                return;
            }

            while (true)
            {
                string data = ipc_api.ApiTcpReceiveData(path_id);
                Utilities.DebugClass.DebugIt("TestServer receive:", data);
                //Thread.Sleep(100);
            }
        }