Пример #1
0
        private void InitWebService()
        {
            UnInitWebService();

            try
            {
                Server.Listener service = new Server.Listener();

                //Check if valid connection (response == OK)

                //Then Add HostName to historic
            }
            catch (Exception ex)
            {
                ManagerLib.Utils.LogService("InitWebService error : " + ex.Message);
            }
        }
Пример #2
0
        private static async Task Do()
        {
            Server.Listener <MyClient> server = new Server.Listener <MyClient>("127.0.0.1", 3586, @"errors\socket");

            using (Client.Sender sender = new Client.Sender("127.0.0.1", 3586))
            {
                string msg = Console.ReadLine();
                while (!string.IsNullOrEmpty(msg))
                {
                    List <byte> data = new List <byte>();
                    data.AddRange(Encoding.Unicode.GetBytes(msg));
                    int length = (data.Count + sizeof(int));
                    data.InsertRange(0, BitConverter.GetBytes(length));
                    await sender.Send(data.ToArray());

                    msg = Console.ReadLine();
                }
            }
        }