Esempio n. 1
0
        static void Main(string[] args)
        {
            byte[] data = File.ReadAllBytes(Directory.GetCurrentDirectory() + @"\text.txt");
            ClientServer.Server server = new ClientServer.Server(998);
            server.debug = new Action <string, int>((string e, int sum) =>
            {
                Console.WriteLine(e);
            });
            var cmd = new Command();

            cmd.operation = "size";
            cmd.action    = new Func <ClientMessage, ServerMessage>((o) =>
            {
                return(new ServerMessage(new BaseEncode(data).GetnetworkEncoding().data.Length.ToString(), true));
            });
            var cmd1 = new Command();

            cmd1.operation = "get";
            cmd1.action    = new Func <ClientMessage, ServerMessage>((o) =>
            {
                return(new ServerMessage("", true, new BaseEncode(data)));
            });
            server.commands = new System.Collections.Generic.List <Command>()
            {
                cmd, cmd1
            };
            server.Start();
            Console.ReadLine();
        }
Esempio n. 2
0
 private static void startServer()
 {
     _Server = new Server("127.0.0.1", 9657);
      _Server.Start();
 }
Esempio n. 3
0
 private static void startServer() {
    _Server = new Server("127.0.0.1", 9657);
    _Server.Start();
 }