The International Simutrans Forum


Author Topic: Network patch - improve logging + remove use of NTOP/PTON  (Read 2117 times)

0 Members and 1 Guest are viewing this topic.

Offline Ashley

  • Coder/Patcher
  • Devotees (Inactive)
  • *
  • Posts: 1288
Network patch - improve logging + remove use of NTOP/PTON
« on: February 18, 2012, 03:26:36 PM »
This patch does a few things:

1. Improves logging for server startup, printing out which addresses the server is listening on (before these were mere debug messages which could be missed).
2. The server fails to start if it cannot listen on any of the addresses specified in the config file. I feel that this should be an error condition since it indicates that the server probably shouldn't be running (e.g. if there is another server bound to the same ports).
3. I've removed the code which uses inet_ntop and inet_pton - this was really unnecessary given that getaddrinfo() does validation (and indeed permits domain names) and getnameinfo() can be made to return numeric IPs by specifying the NI_NUMERICHOST flag (this was incorrectly set to the NI_NUMERICSERV flag in the code).
4. As a result, you can specify a DNS name in the listen directive of, which will be resolved into IP addresses all of which will then be listened on. This is nice for flexible configuration.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Network patch - improve logging + remove use of NTOP/PTON
« Reply #1 on: February 18, 2012, 04:04:08 PM »
thank you!