public void ServerTest() { Server server = new Server(new Listener(new IPEndPoint(IPAddress.Any, 8888)), new ClientsManager()); server.Start(); Thread.Sleep(1000); server.Stop(); }
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(); }