public override void Disconnect()
 {
     if (!_connected)
     {
         return;
     }
     _connected = false;
     _SendUpdate();
     _dataChannel.Close();
     _dataChannel = null;
 }
    public override bool Connect(RobotInfo _ifo)
    {
        if (_connected)
        {
            Disconnect();
        }

        _dataChannel = new RTPDataChannelSender();
        if (_dataChannel.Open(_ifo))
        {
            _connected = true;
        }
        else
        {
            _connected = false;
        }
        return(_connected);
    }
    public override void BroadcastMessage(int port)
    {
        string d;

        lock (_serializer)
        {
            _UpdateData(false);
            d = _outputValues;
            ClearData(false);
        }
        if (d.Length == 0)
        {
            return;
        }
        bool removeClient  = false;
        bool removeChannel = false;

        if (_dataChannel == null)
        {
            removeChannel = true;
            _dataChannel  = new RTPDataChannelSender();
        }
        if (!_dataChannel.IsOpen())
        {
            removeClient = true;
            RobotInfo ifo = new RobotInfo();
            ifo.communicationPort = port;
            ifo.IP = IPAddress.Broadcast.ToString();
            _dataChannel.Open(ifo);
        }
        _dataChannel.Broadcast(d);
        if (removeClient)
        {
            _dataChannel.Close();
        }
        if (removeChannel)
        {
            _dataChannel.Close();
            _dataChannel = null;
        }
    }