コード例 #1
0
        public void RunHelloWorldEchoServer(string msg)
        {
            displayMessageStatic("Starting");

            NetworkingLibrary.TCPServer server = new NetworkingLibrary.TCPServer(messageService: this, responder: new EchoResponder());

            NetworkingLibrary.TCPClient client = new NetworkingLibrary.TCPClient(messageService: this, responder: new EchoResponder());

            server.Start();

            // keep sending messages constantly
            client.SendContinuiously(msg);

            Console.ReadKey();
        }
コード例 #2
0
        public void RunTCPHelloWorldTest(bool withResponce)
        {
            displayMessageStatic("Starting TCP Hello World Test:");

            NetworkingLibrary.TCPServer server;

            // start the listener socket
            if (withResponce)
            {
                server = new NetworkingLibrary.TCPServer(messageService: this, responder: new EchoResponder());
            }
            else
            {
                server = new NetworkingLibrary.TCPServer(messageService: this);
            }

            server.Start();

            displayMessageStatic("Listener Socket Running");

            SetUpTCPConnection();

            Console.ReadLine();
        }