-
Client Software Programmer
XMLSocket Setup
Hi, im attempting everything I can to setup a socket connection but it just wont connect directly on my site, but the socket will establish a connection from the ide this is the flash script I am testing:
PHP Code:
// Create XMLSocket object
Security.loadPolicyFile("crossdomain.xml");
var theSocket:XMLSocket = new XMLSocket();
// Connect to a site on unused port above 1024 using connect() method.
// Enter localhost or 127.0.0.1 for local testing.
// For live server, enter your domain www.yourdomain.com
theSocket.connect('127.0.0.1', 80);
// displays text regarding connection
theSocket.onConnect = function(myStatus) {
if (myStatus) {
conn_txt.text = "success";
} else {
conn_txt.text = "no connection made";
}
};
// data to send
function sendData() {
var myXML:XML = new XML();
var mySend = myXML.createElement("thenode");
mySend.attributes.myData = "someData";
myXML.appendChild(mySend);
theSocket.send(myXML);
}
// button sends data
btn.onRelease = function() {
sendData();
};
// traces data returned from socket connection
theSocket.onData = function(msg:String):Void {
trace(msg);
};
also, I included a crossdomain.xml at the root of my site as follows:
PHP Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for xmlsocket://socks.example.com -->
<cross-domain-policy>
<!-- This is a master-policy file -->
<site-control permitted-cross-domain-policies="master-only"/>
<!-- Instead of setting to-ports="*",
administrators can use ranges and commas -->
<!-- This will allow access to ports 123, 456, 457, and 458 -->
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
I will also add updates to this thread if I get any further but I really need someone to help establish a simple connection and ill worry about the php/java serving with the 0x00
-
Client Software Programmer
update: so I made a boolean to show if System.security.loadPolicyFile("http://www.indocastles.com/crossdomain.xml"); gets the policy file, and it returns true, but the xmlsocket returns false :/
-
.
Hi,
This might give you a little more understanding, http://www.lightsphere.com/dev/artic...et_policy.html
-
Client Software Programmer
i get this in my shell response, hmmm
bind: Permission denied at ./socketpolicy.pl line 50.
Last edited by AS3.0; 06-10-2015 at 04:33 PM.
-
Client Software Programmer
ok, got it running it created a log file which says: starting socket on port 483. but my flash file still seems to not connect.
-
.
HI,
OK , you are getting closer.
How did you execute the perl script on your server and what is the code you use to communicate.
All files and code if you need to go further.
-
Client Software Programmer
Hi, with the link you provided, i created the socketpolicy.pl in the root with pico, i then run the command "chmod +x socketpolicy.pl" so i can run it and last i i run the socketpolicy.pl script by typing this command "./socketpolicy.pl > /dev/null &" and it creates a log in my root which i than open and it reads..
Starting server on port 843
Server started. Waiting for connections.
if you want to read the file just click view source at this link http://www.lightsphere.com/dev/artic...et_policy.html
i also keep the file as is, with the $bindip commented as default and such
Last edited by AS3.0; 06-11-2015 at 01:10 PM.
-
.
Hi,
yes I've seen that page Alloy, I gave you the link,
I just wonder how your fla works, as the same code here doesnt function too well, all it says is success, infact it doesn't even say that anymore.
Ok it does say success, i turned wamp back on.
I have a few socket flas set up here and your seems like it will never work.
Last edited by fruitbeard; 06-11-2015 at 01:27 PM.
-
Client Software Programmer
this is the fla script i upload compiled to swf exactly as it is ports and all
PHP Code:
// Create XMLSocket object
var theSocket:XMLSocket = new XMLSocket();
// Connect to a site on unused port above 1024 using connect() method.
// Enter localhost or 127.0.0.1 for local testing.
// For live server, enter your domain www.yourdomain.com
theSocket.connect('localhost', 80);
// displays text regarding connection
theSocket.onConnect = function(myStatus) {
if (myStatus) {
conn_txt.text = "success";
} else {
conn_txt.text ="no connection made";
}
};
// data to send
function sendData() {
var myXML:XML = new XML();
var mySend = myXML.createElement("thenode");
mySend.attributes.myData = "someData";
myXML.appendChild(mySend);
theSocket.send(myXML);
}
// button sends data
btn.onRelease = function() {
sendData();
};
// traces data returned from socket connection
theSocket.onData = function(msg:String):Void {
trace(msg);
};
let me try your socket script if possible
-
.
-
Client Software Programmer
from desktop again, it says:
PHP Code:
Connected [Event type="connect" bubbles=false cancelable=false eventPhase=2] HTTP/1.1 200 OK
Date: Thu, 11 Jun 2015 18:35:14 GMT
Server: Apache
Transfer-Encoding: chunked
from my site it says: http://indocastles.com/play/indocastles.html
Last edited by AS3.0; 06-11-2015 at 02:35 PM.
-
.
Hi,
I see it, thats because you have no policy being sent to the flash file, look up the security event.
Did you change local for site in the file.
Anyway, you need to do this yourself, i just gave you a file to compare with your AS2 file
Last edited by fruitbeard; 06-11-2015 at 02:58 PM.
-
Client Software Programmer
http://indocastles.com/play/indocastles.html wait acouple seconds and itl output the text error #2048 clear ur cache if it shows a different swf
Last edited by AS3.0; 06-11-2015 at 02:59 PM.
-
.
HI,
Security Error
[SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]
is to do with the policy file not being sent to the flash file from the server
this is where you need to send the policy using the perl file to flash
-
Client Software Programmer
I have the policy server running and your flash file up as is, :/
-
.
well before i go out, mess around , check the code, find out how to get the policy response
-
.
I dont think my file is set up to get the response you require.
You're on your own now Alloy, or maybe some kind soul might step in and help you, I gave you the link.
-
Client Software Programmer
Alright.
Year 99: "old man alloy" - The sockets almost up and running
-
Client Software Programmer
Thanks for all your help and support by the way, ill let you know when i get it
-
Client Software Programmer
the policy server is running, you can try any method on my swf to connect and you will see that socket servers are a myth http://indocastles.com/play/indocastles.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|