Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-22-2007, 02:34 PM   PM User | #1
doc
New to the CF scene

 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
doc is an unknown quantity at this point
What will a flash xml socket connect to - please help - insanity is near

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:XMLSocket = 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>
doc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:46 AM.


Advertisement
Log in to turn off these ads.