Add support for domain names in multiplayer

Bug #1491290 reported by Alex
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Open Rails
Fix Released
Medium
Carlo Santucci

Bug Description

Currently in multiplayer mode domain names (such as openrails.example.com) aren't supported, only IP addresses. It seems like Open Rails isn't querying any DNS servers at all; a call to Dns.GetHostAddresses (http://bit.ly/1fUALuB) should fix this.

Tags: multiplayer
Revision history for this message
Alex (pcuser42) wrote :

I've had a play around and come up with some code that resolves this issue. It's my first time with C# in a while, and first time contributing to Open Rails, so comments and cleanups are welcome :)

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

Thank you for the patch and I hope it's the first of a long series by you :) . Excuse my deep ignorance, but what is the advantage for OR of reaching domain names?

Revision history for this message
Alex (pcuser42) wrote : RE: [Bug 1491290] Re: Add support for domain names in multiplayer

Hi Carlo

For most users IP addresses frequently change, so adding the ability to resolve domain names allows these users to use a dynamic DNS service (such as No-IP) and never have to remember or look up their IP address. It would certainly come as a welcome addition to me, hence why I submitted the patch. :)

Alex

Sent from my phone

-----Original Message-----
From: "Carlo Santucci" <email address hidden>
Sent: ‎4/‎09/‎2015 8:20 a.m.
To: "<email address hidden>" <email address hidden>
Subject: [Bug 1491290] Re: Add support for domain names in multiplayer

Thank you for the patch and I hope it's the first of a long series by
you :) . Excuse my deep ignorance, but what is the advantage for OR of
reaching domain names?

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1491290

Title:
  Add support for domain names in multiplayer

Status in Open Rails:
  New

Bug description:
  Currently in multiplayer mode domain names (such as
  openrails.example.com) aren't supported, only IP addresses. It seems
  like Open Rails isn't querying any DNS servers at all; a call to
  Dns.GetHostAddresses (http://bit.ly/1fUALuB) should fix this.

To manage notifications about this bug go to:
https://bugs.launchpad.net/or/+bug/1491290/+subscriptions

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

How can I test the patch (even if it is a very small patch)?

Revision history for this message
Alex (pcuser42) wrote :

One easy way is to start up a server on the LAN, then use the computer name (as seen in system properties; Windows+Pause) in place of the IP address. The patch works for local PCs too. :)

Alex

Sent from my phone

-----Original Message-----
From: "Carlo Santucci" <email address hidden>
Sent: ‎4/‎09/‎2015 7:20 p.m.
To: "<email address hidden>" <email address hidden>
Subject: [Bug 1491290] Re: Add support for domain names in multiplayer

How can I test the patch (even if it is a very small patch)?

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1491290

Title:
  Add support for domain names in multiplayer

Status in Open Rails:
  New

Bug description:
  Currently in multiplayer mode domain names (such as
  openrails.example.com) aren't supported, only IP addresses. It seems
  like Open Rails isn't querying any DNS servers at all; a call to
  Dns.GetHostAddresses (http://bit.ly/1fUALuB) should fix this.

To manage notifications about this bug go to:
https://bugs.launchpad.net/or/+bug/1491290/+subscriptions

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

I could successfully test the patch both with local and remote server. Patch committed in x.3242. Thank you Alex.

Changed in or:
assignee: nobody → Carlo Santucci (carlosanit1)
status: New → Fix Committed
Changed in or:
assignee: Carlo Santucci (carlosanit1) → nobody
assignee: nobody → Carlo Santucci (carlosanit1)
Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

This patch works with domain names... but IP addresses do not work anymore.

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

I have just successfully tested a connection of two instances of OR within my computer using as exterbak server the tsimserver and inserting as string 74.50.121.15:20666 .

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

exterbak = external

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

More information :
Using local IP address : Works
Using domain name : Works
Using public IP address : Error

Warning: System.Net.Sockets.SocketException: Hôte inconnu (=> Unknown host)
   at System.Net.Dns.GetAddrInfo(String name)
   at System.Net.Dns.InternalGetHostByAddress(IPAddress address, Boolean includeIPv6, Boolean throwOnFailure)
   at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
   at ORTS.MultiPlayer.ClientComm..ctor(String serverIP, Int32 serverPort, String s) in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\MultiPlayer\ClientComm.cs:line 51
   at ORTS.Processes.GameStateRunActivity.InitSimulator(UserSettings settings, String[] args, String mode, String acttype) in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 946
   at ORTS.Processes.GameStateRunActivity.Start(UserSettings settings, String acttype, String[] args) in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 274
   at ORTS.Processes.GameStateRunActivity.<>c__DisplayClass8.<Load>b__3() in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 149
   at ORTS.Processes.GameStateRunActivity.Load() in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 189
   at ORTS.Processes.LoaderProcess.Load() in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 155
   at ORTS.Processes.LoaderProcess.DoLoad() in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 136
   at ORTS.Processes.LoaderProcess.LoaderThread() in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 107
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Connection error - will play in single mode.

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

And connection using public IP address worked before this patch.

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

As written above, testing with public IP address 74.50.121.15 worked. However I don't want to create obstacles and I reverted the patch in release x.3247. A comment on this by Alex would be welcome.

Changed in or:
status: Fix Committed → In Progress
Revision history for this message
Carlo Santucci (carlosanit1) wrote :

Obviously I mean that testing with public IP address 74.50.121.15 worked in release x.3242.

Revision history for this message
Alex (pcuser42) wrote :

Using release X3244, I could successfully connect to my local session with both the local IP address and local host name, and the public IP address 74.50.121.15 without issue.

Revision history for this message
Alex (pcuser42) wrote :

I've included an updated patch that tries to parse the IP address as it did before, and only then calls the DNS if that fails.

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

That's my experience too. Cédric, can you confirm that with x.3247 or following ones you can now connect to a site you couldn't connect with release x.3242-x.3246? Can you provide the IP address of such site?

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

Thanks Alex. Cédric, could you test Alex' patch with your test case before I commit it?

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

Hi,

This new patch works perfectly.
Thank you !

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

And, by the way, when I am playing with my friends, we're not using tsimserver but a direct connection to my server.

Revision history for this message
Carlo Santucci (carlosanit1) wrote :

Re-fixed in x.3251. Thank you, Alex.

Changed in or:
status: In Progress → Fix Committed
James Ross (twpol)
Changed in or:
milestone: none → 1.1
importance: Undecided → Medium
James Ross (twpol)
Changed in or:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.