| | |
What will a flash xml socket connect to - please help - insanity is near
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2007
Posts: 8
Reputation:
Solved Threads: 0
What will a flash xml client socket connect to?
I have a working php TCP/IP server socket bound to a port >1023 and the flash client will not even connect to it. I can connect to it with non-xml client.
Can anyone explain this to me - it has been driving me mad for weeks!
Please help!
Thanks
doc
Working socket code (in php webpage, not as daemon yet)
<?php
// set some variables
$host = "my ip address";
$port = 1234;
// don't timeout!
set_time_limit(0);
// create socket
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n");
// bind socket to port
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
// start listening for connections
$result = socket_listen($socket, 5) or die("Could not set up socketlistener\n");
// accept incoming connections
// spawn another socket to handle communication
$spawn = socket_accept($socket) or die("Could not accept incomingconnection\n");
// read client input
$input = socket_read($spawn, 1024) or die("Could not read input\n");
$output = "Hello"."\0";
socket_write($spawn, $output, strlen ($output)) or die("Could not write output\n");
// close sockets
socket_close($spawn);
socket_close($socket);
?>
<code> for flash client to connect only
// Create your XMLSocket object
var mySocket
MLSocket = new XMLSocket();
text1.text = mySocket;
// Connect to your site
mySocket.connect('myIPaddress', 1234);
mySocket.onConnect = function(success) {
if (success) {
text2.text = "Server connection established!";
} else {
text2.text = "Server connection failed!";
}
}
</code>
I have a working php TCP/IP server socket bound to a port >1023 and the flash client will not even connect to it. I can connect to it with non-xml client.
Can anyone explain this to me - it has been driving me mad for weeks!
Please help!
Thanks
doc
Working socket code (in php webpage, not as daemon yet)
<?php
// set some variables
$host = "my ip address";
$port = 1234;
// don't timeout!
set_time_limit(0);
// create socket
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n");
// bind socket to port
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
// start listening for connections
$result = socket_listen($socket, 5) or die("Could not set up socketlistener\n");
// accept incoming connections
// spawn another socket to handle communication
$spawn = socket_accept($socket) or die("Could not accept incomingconnection\n");
// read client input
$input = socket_read($spawn, 1024) or die("Could not read input\n");
$output = "Hello"."\0";
socket_write($spawn, $output, strlen ($output)) or die("Could not write output\n");
// close sockets
socket_close($spawn);
socket_close($socket);
?>
<code> for flash client to connect only
// Create your XMLSocket object
var mySocket
MLSocket = new XMLSocket();text1.text = mySocket;
// Connect to your site
mySocket.connect('myIPaddress', 1234);
mySocket.onConnect = function(success) {
if (success) {
text2.text = "Server connection established!";
} else {
text2.text = "Server connection failed!";
}
}
</code>
Please explain how you are testing the socket.
It is strange to me that your php script doesnt have a loop...
It is strange to me that your php script doesnt have a loop...
•
•
Join Date: Mar 2007
Posts: 8
Reputation:
Solved Threads: 0
I simplified it for the forum - it listens until it hears something - then moves on and closes down. Similarly my flash did a lot more but I reduced it to just try to connect and get a success message (using .connect and the usual .onconnect).
If I use a php client to just connect, the socket server hears it and closes down as it should.
I hope that helps.
Thanks
Doc
If I use a php client to just connect, the socket server hears it and closes down as it should.
I hope that helps.
Thanks
Doc
Last edited by eldoc; Mar 22nd, 2007 at 12:42 pm.
![]() |
Similar Threads
- Tutorial: Flash-XML Menu (Site Layout and Usability)
- php socket server - can't connect from flash xml client socket (PHP)
- XML Menu Help - Delaying modules? (Existing Scripts)
- interact between php and flash using xml (PHP)
- XML and hyperlink as one of the data (RSS, Web Services and SOAP)
- Problem with Axis (Java)
Other Threads in the PHP Forum
- Previous Thread: PhP Help - Coding
- Next Thread: Simple PHP Question
Views: 4767 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl customizableitems database date directory display download dynamic echo email error file files folder form format forms forum function functions google headmethod href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail malfunctioning menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





