Author Topic: Delay obtaining External IP  (Read 2267 times)

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Delay obtaining External IP
« on: June 04, 2015, 06:29:26 PM »
when using the default stand-alone TNetServer.zip:

there is a HUGE delay between "UPnP Gateway" and "External IP".

is there a way to decrease the delay?  i've literally wasted days of my life because of this delay...



server config:

args = new string[] { "-name", "Game Server", "-tcp", "10420" };

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Delay obtaining External IP
« Reply #1 on: June 07, 2015, 01:04:24 PM »
Days of life eh? Sounds dramatic. Define "huge delay"?

To determine an external address, TNet does an HTTP request to a remote site like icanhazip. It shouldn't take long.

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: Delay obtaining External IP
« Reply #2 on: June 07, 2015, 02:45:30 PM »
for development/testing, im using an internal closed network that does not have access to the internet.

the delay is roughly 15 seconds.  it does add up after 6 months of development... ;p

should i add those url's to the "hosts" file?  this might speed the failure process?

edit:  id prefer the "fix" be code orientated - but the hosts file is what came to mind.
edit #2:  adding the 3 url's to the hosts file removed all delay!
« Last Edit: June 07, 2015, 03:30:23 PM by devomage »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Delay obtaining External IP
« Reply #3 on: June 07, 2015, 03:46:33 PM »
That would certainly explain it. No access to the internet = no external address. TNet simply keeps trying to connect to a remote site in order to determine it, and does try several sites a couple of times. Hosts file approach sounds fine.