0

So, me and a friend built a custom gameserver in java. This gameserver listens for HTTP and TCP messages from a specific ip / port given to it (Either localhost or the device's external IP address for port forwarding). Then, you can take that IP / Port combination and use it in the game, and it connects fine. The server works beautifully. The issue is, we want to setup a domain for the server. The virtual private server hosting the actual gameserver is a Google Cloud Virtual Machine. Im using Cloud DNS to connect my domains to the apache webservers on my VM.

I was wondering if theres a way to connect to my gameserver's IP and Port through a subdomain... such as gateway.gameserver.com

I tried using an SRV record, and plugging in my custom port + ip address, but it didnt respond.

I also tried just connecting to my domain (Which uses the same IP Address as my game server) and adding a port to the end, and that didnt work.

Im out of ideas.

I would really like to be able to connect to my custom gameserver through gateway.gameserver.com instead of 100.100.100.100:5000 or something.

  • "I tried using an SRV record, and plugging in my custom port + ip address, but it didnt respond." Publishing `SRV` records is one thing, but does the client consumes them? Minecraft systems do use that, but it means the minecraft clients specifically queries for `SRV` records and obey them. Is it the case of your client? (not clear what is it). Also, just to be sure, the target of an `SRV` record has to be an hostname, it can't be an IP address. – Patrick Mevzek May 03 '21 at 23:41

1 Answers1

1

Domain names are mapped to IP addresses in DNS via A records. There is no place in A record to specify a port. Ports are usually totally separate from DNS, and depend on the particular application you use. So if the port you are using is non-standard for this particular kind of application, you always have to specify the port explicitly.

SRV records are not general-purpose, they are for use by specific applications that look particularly for this SRV record. If your gaming client supports SRV records, then you can set up a SRV record that will be used by it, otherwise SRV records are of no use to you.

However, if you have an A record (specifying IP address) that points to yourdomain.com, and if the game server runs on this very same IP address, you can definitely use yourdomain.com and the particular port number in your gaming client and it should work, unless the gaming client does not allow for free port selection and uses a fixed port. In this case you must run game server on that port and use only yourdomain.com in your gaming client.

If the domain name does not work in your gaming client, but the very same IP address that the domain name points to does, then either you have done something wrong or the gaming client does not support using domain names at all.

raj
  • 542
  • 2
  • 8
  • The game client allows port forwarding and listening to a specific IP and port, but whenever I select a domain instead of an IP, it doesnt identify it. Im not sure what layer in my system is the cause of the issue, since I just contributed to the project, I didnt create it – Mister SirCode May 03 '21 at 21:36
  • What has game client to do with port forwarding? Port forwarding is server's or router's job, the client just connects to a specified port. Also, have you checked if the game client supports specifying domain names **at all** or only IP addresses? Do you have any other game server available under a domain name that you can try? – raj May 03 '21 at 21:39
  • I apologize, misspoke, I meant the server. And yes, both the game client and the server used to use domains... a previous party was running one on a domain, and was connecting via a domain as well. I would like to know how I could replicate that. – Mister SirCode May 04 '21 at 00:49
  • So if you are able to connect via IP address, you should be able to connect via domain as well, if you replace the IP address with the domain name. Double-check if the domain name is actually pointing to correct IP address. – raj May 04 '21 at 10:24