News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Network suggestion - Use SRV record lookup to determine port for network games

Started by Ashley, January 02, 2011, 01:00:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ashley

DNS SRV records allow you to specify what port a particular service is running on when doing a DNS lookup for a name. We could use these to allow a DNS alias to specify both what IP address a game server is running on as well as the port to connect to. E.g. I could have the DNS names:

pak64.example.com
pak128.example.com

Both pointing to IP address 1.2.3.4, how does the game tell these apart and determine which port the server for each is running on? By doing an SRV record lookup for both domains it could learn that the port that the Simutrans server is running on is say 13353 for pak64 and 13354 for pak128.

SRV records have the form:

_service._proto.name TTL class SRV priority weight port target

E.g. for SIP:

_sip._tcp.example.com. 86400 IN SRV 0 5 5060 sipserver.example.com.

This tells a SIP application to connect to port 5060. We could define a record for Simutrans, e.g.:

_simutrans._tcp.pak64.example.com. 86400 IN SRV 0 5 13353 pak64.example.com.
_simutrans._tcp.pak128.example.com. 86400 IN SRV 0 5 13354 pak128.example.com.

Would allow you to specify the port that Simutrans is running on for each domain name. This has the advantage of reducing the amount of complexity involved in configuring a server connection by removing the need for a player to know the port they need to enter to connect to.

More info about SRV records:
http://en.wikipedia.org/wiki/SRV_record
http://tools.ietf.org/html/rfc2782
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

prissi

Since looking up a DNS address is the least portable part of the networking interface I really am not very keen to touch this.

Moreover the more standard literature does not tell me about how to look up this. (I am almost 100% sure, this will not work on Zeta and may choke on windows ...)

Or what do you suggest to change exactly. I am not very solid in network programming, I am happy that our patched together stack is running IP6 and IP4 on most machines so far.