Author Topic: How to get server name?  (Read 1442 times)

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
How to get server name?
« on: June 29, 2016, 09:09:13 AM »
To aid in debugging, I'd like to see what server I'm connected to. How do I get the server name from within a connected player?

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: How to get server name?
« Reply #1 on: June 29, 2016, 07:32:02 PM »
If you're hosting the server through TNServerInstance:
TNServerInstance.serverName

If you're just a client:
The name is sent when you retrieve the list of channels. So just save it to a variable from there. Otherwise, you could add a custom packet to get the name from the server at any point.
But, for debugging, the IPEndPoint of the server should probably suffice, right? You can get that from TNManager.tcpEndPoint.