I have a very simple flash. It has a single layer:
layer 1: (ActionScript)
myXML = new XMLSocket;
myXML.onConnect = handleConnect;
myXML.onXML = handleXML;
myXML.onClose = handleDisconnect;
myXML.connect("localhost", 8090);
function handleConnect(connectionStatus){
connectionStatus ? trace("Connected.") : trace("Connection failed.");
myXML.send(new XML('"OKzap"'));
}
function handleXML(xmlObject){
var e = xmlObject.firstChild;
if (e != null && e.nodeName == "x") {
displayMessage(e.attributes.user, e.attributes.text);
}
trace("Object recieved:: "+xmlObject);
}
function sendXML(textToSend){
myXML.send(new XML('"+textToSend+"'));
}
function handleDisconnect(){
trace("Connection lost.");
}
function closeConnection(){
trace("Closing connection to server.");
myXML.close();
}
========================
I have some PHP that loads the SWF and tries to connect to it:
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" width="650" height="300">
<param name="movie" value="XMLsocket_test.swf">
<param name="quality" value="high">
<embed src="/kerrypress/XMLsocket_test.swf" quality="high" pluginspage=" type="application/x-shockwave-flash" width="650" height="100"></embed>
</object>
<?php
$status_flash = pfsockopen("localhost", 8090, $errno, $errdesc, 6);
if (! $status_flash) {
die("Could not connect to flash client:\nError: $errno = $errdesc\n");
}
fputs($status_flash, "<x>yahoo</x>\x00"); //send message
?>
================================
The error I'm getting is:
Warning: pfsockopen(): unable to connect to localhost:8090 in C:\Program Files\Apache Group\Apache2\htdocs\....\access.php on line 185
Could not connect to flash client: Error: 10060 = A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
My questions are these:
1. Do I call the SWF file first (<object> ... </object>) and THEN call the PHP pfsockopen() function or the other way around?
2. I've tried "localhost", the actual IP of my local machine (I'm trying to get this to run on my own machine before letting it loose on an external web server) - how do I address the port?
regards
Mark H., AFX
layer 1: (ActionScript)
myXML = new XMLSocket;
myXML.onConnect = handleConnect;
myXML.onXML = handleXML;
myXML.onClose = handleDisconnect;
myXML.connect("localhost", 8090);
function handleConnect(connectionStatus){
connectionStatus ? trace("Connected.") : trace("Connection failed.");
myXML.send(new XML('"OKzap"'));
}
function handleXML(xmlObject){
var e = xmlObject.firstChild;
if (e != null && e.nodeName == "x") {
displayMessage(e.attributes.user, e.attributes.text);
}
trace("Object recieved:: "+xmlObject);
}
function sendXML(textToSend){
myXML.send(new XML('"+textToSend+"'));
}
function handleDisconnect(){
trace("Connection lost.");
}
function closeConnection(){
trace("Closing connection to server.");
myXML.close();
}
========================
I have some PHP that loads the SWF and tries to connect to it:
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" width="650" height="300">
<param name="movie" value="XMLsocket_test.swf">
<param name="quality" value="high">
<embed src="/kerrypress/XMLsocket_test.swf" quality="high" pluginspage=" type="application/x-shockwave-flash" width="650" height="100"></embed>
</object>
<?php
$status_flash = pfsockopen("localhost", 8090, $errno, $errdesc, 6);
if (! $status_flash) {
die("Could not connect to flash client:\nError: $errno = $errdesc\n");
}
fputs($status_flash, "<x>yahoo</x>\x00"); //send message
?>
================================
The error I'm getting is:
Warning: pfsockopen(): unable to connect to localhost:8090 in C:\Program Files\Apache Group\Apache2\htdocs\....\access.php on line 185
Could not connect to flash client: Error: 10060 = A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
My questions are these:
1. Do I call the SWF file first (<object> ... </object>) and THEN call the PHP pfsockopen() function or the other way around?
2. I've tried "localhost", the actual IP of my local machine (I'm trying to get this to run on my own machine before letting it loose on an external web server) - how do I address the port?
regards
Mark H., AFX