Exemple #1
0
        static void Main(string[] args)
        {
            DesktopClient.JsonProtocol protocol = new DesktopClient.JsonProtocol();
            Socket desktopSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("192.168.56.1"), 8008);

            Listener listener = new Listener(endPoint);
            ClientsManager clientManager = new ClientsManager();
            Server server = new Server(listener, clientManager);
            server.Start();

            protocol.Connect(endPoint, ref desktopSocket);

            protocol.SendObject(new Command(Command.Commands.Exit, string.Empty), desktopSocket);

            Command command = protocol.ReadObject(desktopSocket, typeof(Command)) as Command;
            server.Stop();
        }
Exemple #2
0
 public void Setup()
 {
     endPoint = new IPEndPoint(IPAddress.Any, 8008);
     desktopSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     protocol = new DesktopClient.JsonProtocol();
 }
 public void Setup()
 {
     endPoint = new IPEndPoint(IPAddress.Parse("192.168.56.1"), 8008);
     listener = new Listener(endPoint);
     clientManager = new ClientsManager();
     protocol = new DesktopClient.JsonProtocol();
     desktopSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 }