this problem existed at sfs 1x too but was fixed:
how can i use a domain insted of ip?
thanks
domain instead of ip
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Yes you can. I am doing it just fine. Use a C# DNS resolver. here ill post mine.
So just make sure you put that in your awake so it can try to resolve the domain into an IP before you try to connect to it. I have my login script start like that and has boolean switches inside unity to control if it uses the resolver or just an IP.
All thats really important in that code above is everything under the useDnsResolver if statement. Set the serverDomainName to your domain of choice. I just use a dynamic DNS server to redirect it all to my local routers public IP.
Code: Select all
public class LoginGUI : MonoBehaviour
{
private SmartFox smartFox;
private string zone = "SimpleChat"; //Zone to connect to
private string lobby = "The Lobby"; //Room to connect to
public string serverName = "192.168.1.10"; //My local server
public int serverPort = 9933;
public bool useDnsResolver = true;
public string serverDomainName = "wikked.failhub.net"; //My domain name
private string username = "";
private string password = "";
private string loginErrorMessage = "";
private bool isLoggedIn;
private bool isJoining = false;
public bool useUDP = true;
public GUISkin gSkin;
private Room currentActiveRoom;
private Rect windowRect;
void Awake()
{
Screen.showCursor = true;
Screen.lockCursor = false;
if (useDnsResolver)// Enable a DNS Resolver to obtain servers public IP from a domain name
{
IPHostEntry ip = Dns.GetHostEntry(serverDomainName);
IPAddress[] ipA = ip.AddressList;
if (ipA.Length > 0)
{
serverName = ipA[0].ToString();
}
}
}
So just make sure you put that in your awake so it can try to resolve the domain into an IP before you try to connect to it. I have my login script start like that and has boolean switches inside unity to control if it uses the resolver or just an IP.
All thats really important in that code above is everything under the useDnsResolver if statement. Set the serverDomainName to your domain of choice. I just use a dynamic DNS server to redirect it all to my local routers public IP.
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Who is online
Users browsing this forum: No registered users and 54 guests