Exemplo n.º 1
0
        public void StartServer(OTcpServerCommands commands, string address, int port, TransferType transferType)
        {
            IPAddress _IPaddress = IPAddress.Parse(address);

            listener      = new TcpListener(_IPaddress, port);
            this.Type     = transferType;
            this.Commands = commands;
            listener.Start();
            accept = true;


            Console.WriteLine($"OTcp Server started. Listening to TCP clients at {address}:{port}");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            OTcpServerCommands cmds = new OTcpServerCommands();

            cmds.AddCommand("osman", keke);
            OTcpServer server = new OTcpServer();

            server.StartServer(cmds, "127.0.0.1", 12345, TransferType.JSON);
            //server.AddCommand("osman", keke);
            //Non responding void functions
            //server.AddCommand("nene", nene);
            // Non responding data functions
            // Non responding basic data types
            //Basic data types
            //server.AddCommand("dede", integerRT);
            //
            server.Listen();
        }