UdpClient not closing when calling "close()"
I've got an WPF application in which one of the windows has an class which at the same time is constantly sending a series of data through an udp non-blocking socket.

This is the piece of code I use to send the data:

        public void EnviaDatos()
        {
            PackData();
            var udpClient = new UdpClient();
            byte[] sendBytes = null;

            udpClient.EnableBroadcast = true;
            udpClient.Connect(IPAddress.Broadcast, Puerto);
            sendBytes = GetBytes();
            udpClient.Ttl = 10;
            udpClient.Send(sendBytes, sendBytes.Length);
            udpClient.Close();
        }

The problem is, when I close this window, holding the object that hosts this code, the socket remains open, instead of being destroyed or even closing by effect of the close() call.

Is this normal behavior? Am I doing anything wrong?

UdpClient not closing when calling "close()"
===

I've got an WPF application in which one of the windows has an class which at the same time is constantly sending a series of data through an udp non-blocking socket.

This is the piece of code I use to send the data:

        public void EnviaDatos()
        {
            PackData();
            var udpClient = new UdpClient();
            byte[] sendBytes = null;

            udpClient.EnableBroadcast = true;
            udpClient.Connect(IPAddress.Broadcast, Puerto);
            sendBytes = GetBytes();
            udpClient.Ttl = 10;
            udpClient.Send(sendBytes, sendBytes.Length);
            udpClient.Close();
        }

The problem is, when I close this window, holding the object that hosts this code, the socket remains open, instead of being destroyed or even closing by effect of the close() call.

Is this normal behavior? Am I doing anything wrong?
