SRV DNS Record with Custom Ports. Am I misunderstanding what SRV is supposed to do?

89

Protocols (well the applications that implement them) have to be designed to take advantage of SRV records.

Take Outlook for example. When it tries to automatically look up your Exchange server, it will look for an SRV record based on the domain part of the email address (_autodiscover._tcp.{domain}). If found, it will connect to the server and port specified in the SRV record (so SRV records can be used to allow SRV aware applications to run on non-standard ports, transparent to the user).

Most protocols (such as RDP, HTTP, various email protocols, etc) have not been designed to take advantage of SRV records (and it doesn't look like most of them ever will either).

When you RDP to newhostname.bbb.com, the RDP client is just trying to get the A record for newhostname.bbb.com, and connecting to that on the default port, unless you manually specify a different port.

What you would need is the RDP client to look for an SRV record for the hostname that you enter (which would most likely be something like _rdp._tcp.example.com, as all SRV records follow a _service._protocol.aaa.bbb format), and then connect to the host/port specified in that SRV record. This obviously would require changes to the RDP client application.

Share:
89
Stanislav Levčhenko
Author by

Stanislav Levčhenko

Updated on September 18, 2022

Comments

  • Stanislav Levčhenko
    Stanislav Levčhenko almost 2 years

    So, it's been 4 hours since I started struggling here.

    See, I've got this comboBox and it's bound to a List<>, - loads up like it's supposed to; but here I've also got a textBox which is supposed to contain text for filter criteria of the List<>. Goes nice, packs all the filtered items into a new list, the comboBox displays it... But when I choose to pick an item from it, i.e. a comboBox.Item, it returns the items from the first list. Yes, the first list, displaying the values from the filtered list; those values are class objects I'm packing into a dataGridView later on.

    Here's the TextChanged:

        private void textBox4_TextChanged_1(object sender, EventArgs e)
        {
            IEnumerable<artikal> filtered =
                from artikal in art
                where artikal.naziv.ToUpper().Contains(textBox4.Text.ToUpper()) || artikal.plu.Contains(textBox4.Text) || artikal.barkod.Contains(textBox4.Text)
                select artikal;
            comboBox1.DataSource = null;
            comboBox1.Items.Clear();
            List<artikal> filter = filtered.ToList<artikal>();
            comboBox1.DataSource = filter;
    

    and here's the class, I mean, if it's this important, but I'm not convinced it is:

    public class artikal
        {
            public string plu { get; set; }
            public string naziv { get; set; }
            public string kolicina { get; set; }
            public string nabavnaCena { get; set; }
            public string prodajnaCnea { get; set; }
            public string barkod { get; set; }
            public override string ToString()
            {
                return plu + " " + naziv;
            }
        }
    

    This art list is a global list defined above all else in the world. Here is how I populate the gridview:

    public partial class NabavkaFrm : Form
    {
        #region some stuff lying here
    
        List<item> art = new List<item>();
        // other code
        row.Cells[0].Value = art[comboBox1.SelectedIndex].plu;
        row.Cells[1].Value = art[comboBox1.SelectedIndex].naziv;
    }
    

    So, yeah, any suggestions? And good time o' the day to everyone passing by :D

    • CodingYoshi
      CodingYoshi about 6 years
      Do you only want "boys" to answer your question? If not, remove that and welcome to 2018.
    • Stanislav Levčhenko
      Stanislav Levčhenko about 6 years
      okok, sorry, never again, I guess :D
    • Mate
      Mate about 6 years
      Read about Refresh() and ResetBindings()
    • CodingYoshi
      CodingYoshi about 6 years
      Are you sure? How do you know the item is from the previous list?
    • Stanislav Levčhenko
      Stanislav Levčhenko about 6 years
      Well, see, this list is parsed from a file into the 'art' list of objects. Then, what I did is that I put a button to throw the selected item into a dataGridView just below the other controls; instead of putting the selected filtered item it puts, e.g. the very first item. Let me try to explain: if the first and second items are "one" and "two" respectively, after filtering "six" and "seven" are on their place, but whenever I try to select the "six", it throws the "one" into the dataGridView, so the "seven" throws "two". Also, thank you all for the replies.
    • Stanislav Levčhenko
      Stanislav Levčhenko about 6 years
      I've tried tons of stuff here, like trashing memory with "aux" lists, setting bindingSources and updating them and nothing, literally nothing ever helped, I'd either break the code down, or achieve the same old stuff I described in the question.
    • Sefe
      Sefe about 6 years
      Unless you provide some runnable code hat reproduces your proble, it will be hard to help you.
    • CodingYoshi
      CodingYoshi about 6 years
      I am pretty confident the issue is not in the code you have posted. The issue is where you get the selected item and display it in the gridview. To test, instead of displaying in a gridview, show the selected item in a message box and see what you get.
    • Stanislav Levčhenko
      Stanislav Levčhenko about 6 years
      Well, I must have asked it wrong, then. The data from the list is displayed in a comboBox and after this linq query it's updated, but the selected items are the old ones yet. The complete form code's in the answer, not to make the question a trashload of text.
  • Louis van Tonder
    Louis van Tonder about 11 years
    Thanks. Makes perfect sense, also thanks to David for his help.
  • USD Matt
    USD Matt about 11 years
    I wouldn't say 'most' protocols - there are hundreds at least. I was unaware that there were proposals to use SRV for IMAP/POP3/SMTP although is this supported by the major email clients? I grant you that SRV and MX are a bit similar but the glaring ommision is no port specification in MX so your server has to be on port 25.