By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,688 Members | 1,893 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,688 IT Pros & Developers. It's quick & easy.

What will a flash xml socket connect to - please help - insanity is near

P: 8
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)
[FONT=Arial][SIZE=2]<?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");[/SIZE][/FONT]
[FONT=Arial][SIZE=2]// 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");
[/SIZE][/FONT][FONT=Arial][SIZE=2]$output = "Hello"."\0";
socket_write($spawn, $output, strlen ($output)) or die("Could not write output\n");
[/SIZE][/FONT][FONT=Arial][SIZE=2]// close sockets
socket_close($spawn);
socket_close($socket);[/SIZE][/FONT]
[FONT=Arial][SIZE=2]?>[/SIZE][/FONT]


<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>
Mar 22 '07 #1
Share this Question
Share on Google+
3 Replies


iam_clint
Expert 100+
P: 1,208
you were able to telnet to it?


http://www.adobe.com/support/flash/a...ionary860.html
Mar 22 '07 #2

P: 8
doc
Not tried that - I was able to use a php client socket though. I appreciate that in that case I was using a server sided programme whereas the flash in client sided (as telnet would be) so perhaps I need to check that out.

Cheers

doc
Mar 22 '07 #3

P: 8
doc
you were able to telnet to it?


http://www.adobe.com/support/flash/a...ionary860.html
Just tried to telnet to php socket server and it works fine.

doc
Mar 23 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.