void recibir(IAsyncResult result) { try { IPEndPoint RemoteIP = new IPEndPoint(IPAddress.Any, 7171); byte[] recibido = client.EndReceive(result, ref RemoteIP); data = Encoding.UTF8.GetString(recibido); formCliente.Invoke(new MethodInvoker(delegate { formCliente.mensajes("\nRecibido: " + data); })); client.BeginReceive(new AsyncCallback(recibir), null); } catch (Exception ex) { MessageBox.Show("Ocurrio un error"); Console.WriteLine(ex.Message); } }