GetServerIpFromMasterServer: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Server function}} {{New feature/item|3.0161|1.6.0|22890|This function returns the remote address as reported by the first master server that provides this value.}} {{Note|It might take a while until the master server responds to the query sent out by the server, which in turn means that this function will not return any IP until the information has been received.}} {{Note|On client-side there is the getServerIp function, in case you need the remote addre...") |
mNo edit summary |
||
Line 4: | Line 4: | ||
{{Note|It might take a while until the master server responds to the query sent out by the server, which in turn means that this function will not return any IP until the information has been received.}} | {{Note|It might take a while until the master server responds to the query sent out by the server, which in turn means that this function will not return any IP until the information has been received.}} | ||
{{Note|On client-side there is the [[getServerIp]] function, in case you need the remote address of the currently connected server.}} | {{Note|On client-side there is the [[getServerIp]] function, in case you need the remote address of the currently connected server.}} | ||
{{Note|If you want to retrieve the server IP address from the server configuration, then you should use <code>getServerConfigSetting("serverip")</code>, but this might yield only <code>"auto"</code> if the default value was used.}} | |||
==Syntax== | ==Syntax== |
Latest revision as of 19:47, 8 January 2025
Syntax
string getServerIpFromMasterServer ( )
Returns
A string containing the remote address of the server as reported, once it's available.
Example
This example creates a console command that outputs the server's IP to the chatbox.
function outputServerIp() outputChatBox(getServerIpFromMasterServer()) end addCommandHandler("serverIp", outputServerIp)
See Also
- getMaxPlayers
- getServerConfigSetting
- getServerHttpPort
- getServerName
- getServerPassword
- getServerPort
- isGlitchEnabled
- setGlitchEnabled
- setMaxPlayers
- setServerConfigSetting
- setServerPassword
- shutdown