private void btnClient_Click(object sender, EventArgs e) { //client = new ClientModel("127.0.0.1"); client = new ClientModel(); // client.OnConnectedToServer += Client_OnConnectedToServer; client.OnDataReceived += Client_OnDataRecived; while (!client.ConnectToServer()) { Thread.Sleep(100); } NetworkStates clientState = client.State; btnsendfromserver.Visible = false; btnServer.Visible = false; btnCloseServer.Visible = false; }