private void MensajeRecibido(ConexionTcpHost conexionTcp, string datos) { if (!Conectado) { this.conexionTcp = conexionTcp; Nombres[1] = datos; Conectado = true; Invoke(new Action(() => label4.Text = Nombres[1])); return; } var paquete = new Paquete(datos); int lugar = Convert.ToInt32(paquete.lugar); elegirColumna(lugar, '#'); Invoke(new Action(() => Habilitar())); }
private void AceptarClientes() { do { try { var conexion = _tcpListener.AcceptTcpClient(); var srvClient = new ConexionTcpHost(conexion) { ReadThread = new Thread(LeerDatos) }; srvClient.ReadThread.Start(srvClient); if (OnClientConnected != null) { OnClientConnected(srvClient); } } catch (Exception e) { MessageBox.Show(e.Message.ToString()); } } while (true); }
private void ConexionCerrada(ConexionTcpHost conexionTcp) { MessageBox.Show("CONEXION TERMINADA, EL JUEGO SE CERRARÁ", "JUEGO TERMINADO", MessageBoxButtons.OK, MessageBoxIcon.Information); Salir(); }
private void ConexionRecibida(ConexionTcpHost conexionTcp) { //MessageBox.Show("CONEXION INICIADA", "JUEGO INICIADO", MessageBoxButtons.OK, MessageBoxIcon.Information); conexionTcp.EnviarPaquete(new Paquete(Nombres[0])); }