Lummox JR wrote:
little desire to approach this.
Lummox JR wrote:
Libcurl is likely to be more worth the time.

Really not sure why you're bumping this with these kinds of replies. It's obvious that Lummox doesn't see the benefits outweighing the cost of actually implementing this.
Well he didn't outright say no, so I shall remain hopeful.
GPE is right; I'm still not seeing the cost/benefit payout, and the difficulty researching this is enormous.

I won't rule this out completely, but I will say it's not happening in 511.
If lack of research means ignoring Google, then perhaps.
Here, have the second Google search result: http://stackoverflow.com/a/9464183/583841
As iterated in the thread before, its only necessary for dreamseeker/pager.
In response to Somepotato
Barring that you didn't say what search you used, you do realize that Google displays different results for different users? That result doesn't show up anywhere for me if I search "srv record".
That stackoverflow link is also super general, and doesn't delve into the specifics I need.
I'll work on a C++ implementation and send it your way.
This would be a wonderful addition to have. I'm currently struggling with having a web browser redirect to a server address, and this would solve that issue.

We can already use web browsers to open clients and connect to servers when using byond:// ALP, so why not support it looking up SRV records as well?
oh wow I totally forgot about this, guess I never came forth with the implementation
yeah guess you didn't do that one thing you said you'd do that lummox really needed huh

edit: huh huh huh
bump
Bumping with some actual content, because SRV records are useful and *very easy*. I'm talking one function call. In prose:

  1. Hook wherever you currently prepare to connect to a "byond://example.com/" address.
  2. If the address has a port *explicitly specified*, don't do any of the following. Proceed as you always have.
  3. If the address omits the port, perform the SRV record lookup, by...
  4. Taking the "example.com" part of the address and prepending "_byond._tcp." to it: "_byond._tcp.example.com". This is how SRV records are formatted. "byond" is the service name, and "tcp" indicates that it's a TCP-based connection.
  5. Call DnsQuery on this name, with DNS_TYPE_SRV and DNS_QUERY_STANDARD.
  6. If it returns 9003 (DNS_ERROR_RCODE_NAME_ERROR), there was no SRV record found. Connect on the default port.
  7. If it returns nonzero, there was some other error. Connecting on the default port is probably the sane behavior.
  8. If it returned zero, a SRV record was found, and should be used.
  9. Examine the results. The final hostname and port are in the Data union, SRV variant, fields pNameTarget and wPort.
  10. Change the hostname from "example.com" to the value of pNameTarget, and the port from the default BYOND port to the value of wPort.
  11. Continue connecting as normally.


And you're done.

SRV records also allow a system of "priority" and "weight" for load-balancing but it can be safely ignored. Now servers can have pretty URLs for what should amount to ten or maybe twenty lines of code.

In code, here's a complete, compilable & runnable example that hits up a SRV record I used to use. Non-robust in error handling terms but it should serve as a sufficient demonstration and debugging tool.

#include <windows.h>
#include <windns.h>
#include <stdio.h>

int main() {
    PDNS_RECORD results = NULL;
    printf("%d\n", DnsQuery("_minecraft._tcp.beta.platymuus.com",
        DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &results, NULL));
    printf("%p\n", resuls);
    if (results) {
        printf("%s\n", results->pName);
        printf("Right type? %d\n", results->wType == DNS_TYPE_SRV);
        printf("SRV name: %s\n", results->Data.SRV.pNameTarget);
        printf("SRV port: %d\n", results->Data.SRV.wPort);
    }
}


Be sure to link dnsapi.

Output:
0
0000000000791490
_minecraft._tcp.beta.platymuus.com
Right type? 1
SRV name: hs.platymuus.com
SRV port: 13000
Oh wow I totally forgot to reply with the example I had -- I wrote it into a simple C function and just never replied whoops. But yeah do this please!
I've added some srv records.


sybil.tgstation13.org should resolve to sybil.game.tgstation13.org:1337

bagil.tgstation13.org should resolve to bagil.game.tgstation13.org:2337

Bonus points, these subdomains also have cnames as well so you'll know how your system handles that lummox.
Page: 1 2