Page 1 of 1

SimpleConnect Not Working?

Posted: 02 May 2006, 20:19
by mrTip
Hello,

Yes; I have another question. My SimpleConnect AS is as follows:

Code: Select all

import it.gotoandplay.smartfoxserver.*

/*
* ----------------------------------------------------------------------------
*	[ Advanced Chat ] version 1.1.0
*	a SmartFoxServer sample application
*
*	www.smartfoxserver.com
*	(c) 2004 gotoAndPlay()
* ----------------------------------------------------------------------------
*/
stop()

//----------------------------------------------------------
// Server configuration
//
// ip 	= IP address of the server, if the server is running
// 		  locally use 127.0.0.1
// port	= default value is 9339
//----------------------------------------------------------
var ip:String 		= "70.60.138.26"
var port:Number 	= 9339
var zone:String 	= "simpleChat"

var smartfox:SmartFoxClient = new SmartFoxClient()
smartfox.onConnection = handleConnection
smartfox.debug = true

// Connect to the server
smartfox.connect(ip, port)


//----------------------------------------------------------
// Handle connection response from server
//----------------------------------------------------------
function handleConnection(success)
{
	if (success)
	{
		status_txt.text = "Connection succesfull!"
	}
	else
	{
		status_txt.text = "Can't connect!"
	}
}
I can get into my admin tool AND TheoChat, but this simpleConnect doesn't work. It's very weird, because when I test the simpleConnect file in Flash, it works, but when it's on the Internet, it doesn't connect. Yes, I do have crossdomain.xml file and it is enabled in my config file.

[edit] when i insert the "System.security.loadPolicyFile("xmlsocket://70.60.138.26:9339")" line into my movie, it just says "connecting" and shoots out no error or anything :)

whenever i test the movie in flash mx 2004, it gives me this output as well:

Code: Select all

[Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='102' /></body></msg>

[Received]: <cross-domain-policy><allow-access-from domain="*" to-ports="9339" /></cross-domain-policy>
[Received]: <msg t="sys"><body action="apiOK" r="0" /></msg>
im still searching the docs for answers but havent found one yet

any ideas? thanks in advanced

Posted: 04 May 2006, 07:00
by Lapo
It works perfectly for me... I've checked connection to your IP address.
Do you use flash player 8? or 7?

Posted: 04 May 2006, 16:51
by mrTip
Wow, it works for you?

Flash Player 8... I use MX 2004 Professional for developing flash

http://thedailyneopets.com/SFS_PRO_1.4. ... onnect.swf thats what im trying to get to work =]

Posted: 05 May 2006, 04:09
by stmulligan
I had this same issue. Simple and Advanced chat work inside the Flash MX 04 runtime environment but the SWF file I publish to the website cannot connect.

I changed the raw IP to my domain and all is well. For example:

var ip:String = "www.mydomain.com"
var port:Number = 9339
var zone:String = "simpleChat"

Hope that helps.

---St. Mulligan---

Posted: 05 May 2006, 07:25
by Lapo
This is the problem:

- you're connecting to 70.60.138.26

the flash player will search for the crossdomain file at:
http://70.60.138.26/crossdomain.xml

but the file is not there, so it doesn't work

Since the server can automatically send the policy file, please use that feature instead. Check this article

Posted: 05 May 2006, 16:34
by mrTip
Hello!

Stmulligan's method works (it will now establish a successful connection), but I want to get things working the right way, so I want to attempt it Lapo's way.
...please use that feature instead.
What feature are you talking about exactly? Using System.security.loadPolicyFile? I tried putting in 'System.security.loadPolicyFile("xmlsocket://70.60.138.26:9339")' in the flash movie before and it won't establish a connection.

Thanks so much for your paitence (I'm a newbie) and time I truly do appreciate it. :D

Posted: 05 May 2006, 18:10
by Virusescu
you also have to set inside the configuration xml file the
<AutoSendPolicyFile> tag to TRUE

Posted: 05 May 2006, 21:05
by mrTip
Yes, that has been set to 'true' the whole time. :)

Posted: 13 Jul 2006, 22:56
by aajames
hello,

I am running into this problem as well. I can only connect if I am running the file within flash itself... when i open it in a browser i get the warning message and i can not connect.

First off, when i insert into the flash project the line "System.security.loadPolicyFile("xmlsocket://70.60.138.26:9339")"

I get a flash action script error:
**Error** Scene=Scene 1, layer={ code }, frame=9:Line 55: There is no method with the name 'loadPolicyFile'.
System.security.loadPolicyFile("xmlsocket://192.168.0.104:9339");

Am I missing something here?

Also, I have 2 computers at home... one is a linux web server that is hosting the .swf files... the second is my local computer that hosts the server (192.168.1.104).

thanks

Posted: 14 Jul 2006, 05:13
by Lapo
I get a flash action script error:
**Error** Scene=Scene 1, layer={ code }, frame=9:Line 55: There is no method with the name 'loadPolicyFile'.
System.security.loadPolicyFile("xmlsocket://192.168.0.104:9339");
Unfortunately this is a problem with Flash (MX 2004) and we can't do nothing about it.
FMX 2004 had a bug where the System.security would not work because of a missing file in the installation.
I know that many people have solved the problem by completely uninstalling Flash and re-installing it again.

Also, it seems that Flash 8 is not affected by that bug

hope it helps