Beispiel #1
0
        static void Main(string[] args)
        {
            logger.SetLog(new Log());
            ServerSocket server = new ServerSocket(new ServerFactory());

            server.Listen(9999);
            ClientSocket client = new ClientSocket(new ClientFactory());

            client.Connect("localhost", 9999);
            while (true)
            {
                string str = Console.ReadLine();
                if (str.StartsWith("file "))
                {
                    ClientConnection.GetInstance().SendFile(str.Replace("file ", ""));
                }
                else if (str.StartsWith("cmd "))
                {
                    ClientConnection.GetInstance().Send(3, 0, Encoding.UTF8.GetBytes(str.Replace("cmd ", "")));
                }
                else if (str == "exit")
                {
                    ClientConnection.GetInstance().Disconnect();
                    break;
                }
                else
                {
                    ClientConnection.GetInstance().Send(100, 9999, Encoding.UTF8.GetBytes(str));
                }
            }
            Console.ReadKey();
        }
Beispiel #2
0
 public ScorpioConnection create()
 {
     return(ClientConnection.GetInstance());
 }