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); } }
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(); } } }