UDP client only receives a message and freezes
the timer runs only once and do not know how to follow him to clinte UDP messages coming
namespace temp {
public partial class Form1 : Form
{
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
}
only run once
private void timer1_Tick(object sender, EventArgs e) {
UdpClient client = new UdpClient();
IPEndPoint localEp = new IPEndPoint(IPAddress.Any, 22);
client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
client.Client.Bind(localEp);
IPAddress multicastaddress = IPAddress.Parse("127.0.0.1");
Byte[] data = client.Receive(ref localEp);
string mensaje = Encoding.UTF8.GetString(data);
label1.Text += "" + mensaje.ToString() + "";
}