//static int x; //private static BackgroundWorker mainBackgroundWorker; /// <summary> /// The main entry point for the application. /// </summary> //[STAThread] static void Main() { //Console.WriteLine("EchoSync"); //Console.Out.WriteLine("EchoSync Out"); Logger.Init("C:\\Temp\\application.log"); Logger.Log("first log message"); //smallFunc(); /*Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 f = new Form1(); Application.Run(f); Console.Out.WriteLine("line"); f.textBox1.Text = "test string 1";*/ EchoSyncSocket serverSocket = new EchoSyncSocket(); serverSocket.InitClient(Network.SERVER_HOST, Network.SERVER_PORT); while (true) { String line = Console.ReadLine(); if (line == "") break; byte[] msg = System.Text.Encoding.UTF8.GetBytes(line); Console.Write(msg); serverSocket.Write(msg, 0, msg.Length); } }
public Task <EchoSyncSocket> EchoSyncSocketFromTcpClientTask(object state, TcpClient client) { Console.WriteLine("EchoSyncSocket.EchoSyncSocketFromTcpClientTask"); var tcs = new TaskCompletionSource <EchoSyncSocket>(); EchoSyncSocket ess = EchoSyncSocketFromTcpClient(client); tcs.SetResult(ess); return(tcs.Task); }
public Server() { clientSockets = new List<EchoSyncSocket>(); try { serverSocket = new EchoSyncSocket(); serverSocket.InitServer(); AcceptClient(); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(false); }