View Full Version : Need help wit unity = /
flamy
02-25-2011, 05:12 AM
hi there im jus getting strted wit ES5 i installed it and successfully logged in using ES5 admin but whn i tried to run unity example of ConnectAndLoginManually file it some some error like below whn i tryed to connect
Connection failed :unable to connect,as no valid crossdomain policy found.
could some one help me out with this plzzzzzzz
tcarr
02-25-2011, 02:18 PM
First check that the AS3 examples that came with ES5 work correctly. If they do, then test the Unity examples. In (most of) the examples that come with ES5, we assume that the client is on the same host as the ES5, so that 127.0.0.1 is the correct IP. Is that your situation?
If you are testing from inside Unity Editor, you may need to comment out the PreFetch line, depending on the version of Unity that you have and the version of ES5 you installed. If you changed the 127.0.0.1 to a hostname, the PreFetch line will die - it requires a dotted IP for some strange reason. I can give you a code snippet for forcing PreFetch to cooperate if you have a hostname and don't want to use the dotted IP.
flamy
02-26-2011, 01:24 PM
thanks it works now ... but wat i need is the server shd run in one system for ever and the other system connects to it if it is so 127.0.0.1 bcomes usless so i need a server name thts the prob now
tcarr
02-26-2011, 02:27 PM
First you have to follow Enabling Remote Access to ElectroServer (http://www.electrotank.com/docs/es5/manual/enabling_remote_access_to_elec.htm). I'm not at the office today, so I'll have to wait until I'm there to look up how to force PreFetch to use a hostname instead of an IP address, or you can try googling it on the Unity forums. That tip will be in the ES5 manual the next time that I upload a new version of it (did that last week). Hmm... or you can download the zip for my Unity Avatar Chat example (http://www.electrotank.com/docs/es5/zips/AvatarChat.zip) which uses that way to do the PreFetch.
flamy
02-26-2011, 02:53 PM
Thanks for ur help ... thanks a loooot
tcarr
02-28-2011, 01:38 PM
How to convert a hostname to an IP address in C# for Unity:
using System.Net;
private string getIP(string host)
{
return Dns.GetHostAddresses(host)[0].ToString();
}
Then in your PreFetch line, use getIP(hostname). It works even if the hostname is already an IP address, which is very convenient for applications where the user is allowed to choose an IP address or hostname to connect to.
Powered by vBulletin® Version 4.1.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.