Exemplo n.º 1
0
        public static void RunAsClient(object ip_addr_port_var)
        {
            IpAddrPort ip_addr_port = (IpAddrPort)ip_addr_port_var;

            IpcBaseClass ipc_base = new IpcBaseClass();
            IpcApiClass  ipc_api  = ipc_base.IpcApi;

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

            if (path_id == -1)
            {
                //this.debugIt(true, "TestClient", "***** path_id == -1");
                return;
            }

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

            IpcBaseClass ipc_base = new IpcBaseClass();
            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);
                //this.debugIt(true, "TestServer receive:", data);
                //Thread.Sleep(100);
            }
        }