Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




FMS Vs. Unity Vs. Socket Server Vs. Other



Hello...

I’m in the process of figuring out the best technology for an upcoming project, and was hoping I could get you guys to weigh-in with your opinions. To get you on the same page, the project is basically a multi-person game with chat rooms, and will not use any audio or video. All backend operations will be handled by ColdFusion MX7. The part in question is the real-time communication between Flash and ColdFusion via some technology like Flash Media Server (FMS), Unity, or a custom XML socket server. I personally have an idea of what I would choose, but I’m looking for some good input including pros and cons for some of the possible technologies that can be used here. Here are some of the initial questions that come to mind:

- With no audio or video being used, is FMS too big of an overhead code wise as well as money wise?
- Would FMS solve the problem of firewalls with the least overhead with the use of HTTP tunneling?
- Which option handles global persistent data with the least amount of coding overhead?

That list could go on for days, but I'm just trying to give you an idea of where my head is at. Anyways, thanks in advance for any thoughts shared on this one.



ActionScript.org Forums > Supporting Technologies > Flash Media Server
Posted on: 02-03-2006, 03:21 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Unity Socket Server
Anybody here worked on the Unity Socket Server....i.e. developed anything in Flash using the Unity Socket Server.

I want to make a multiplayer game using the XML Socket in Flash but dont know how to make rooms in Unity and how to handle my users...

Edmack Or Some One, Unity Server Help Please
hi Guys,
Ive just been playin around with Moocks unity server and to my amazment i actually got it working locally with a luvly little chatroom, however is it true that you need a dedicated server to run it on or can you just have it some where that supports Java?

Xml Socket & Web Server
Hi.

I am trying to publish a flash page in IIS to the local network on the same subnet and then use the xml socket function to connect to a winsock server on the same machine as IIS resides, on that machine i can do this by using 'localhost' but i cant seem to connect from the remote machine. This is some of the code I am using: -

serverip = "192.168.0.2";

serverskt = 10101;

sock = new XMLSocket();
sock.onConnect = onSockConnect;
sock.onXML = myOnXML;
sock.connect(serverip, serverskt);

I have tried various ways of doin this, like:-

serverip = "http://flashserver/";
serverip = "http://192.168.0.2/";

But none of these work, as anyone any suggestions?

Thanks

Mark

Socket Server
I was wondering if anybody knew of some pre-made socket servers that I could install on my server and use. Any ideas?

Socket Server
Does anybody where can i find some free socket server for testing?
I learn from book now about chat in XML and i will try some functions.

Thanks

Jan

Socket Server .NET
Ive been trying to get sockets working in flash and have been having lots of problems connecting to the socket server.

Ive used a couple in C#.NET and VB.NET using AcceptTcpClient() and a Bind Listen way.

In flash when I call socket.connect it returns true but it never calls onConnect. The server gets the connection but then just says it disconnected.


Any ideas?

Socket Server
Anyone know a free socket server?

PHP + XML Socket Server
Hey everyone,
I'm looking for either a tutorial or a completely done server. Here's what I have so far: I have over 100 different "worlds" on my website that each need to have a subdirectory of chat rooms.
IE:
Quote:




PHP DEVELOPMENT (category)
--->Socket Servers(room)
--->MySQL Integration(room)
--->Random Talk(room)

AJAX DEVELOPMENT(category)
--->Nifty XML(room)
--->Not detergent(room)

TK DEVELOPMENT(category)
--->What you can do to help(room)
--->TK is an endangered species(room)
--->Save the TK Fund(room)
--->That guy is weird(room)
--->Open Discussion or something like that(room)






The categories are predefined by a database I've got. Users need to be able to create a chat room in a category, and I need to be able to list all rooms out in a category so users can chat in rooms relevant to their subject. The engine needs to interpret the messages and send the messages to the right chat rooms and categories. I'm assuming that I'll be needing to print out XML so that flash can interpret it or the like. Each user will be carrying a variable that determines what category they are browsing so when they come to my chat 'page' they'll see all the open chats running in their current subject as well as all the categories so they can change to a different category if need be.

I also need certain functionality. Users need to be able to whisper to one another, and there will be a host (chat-starter) for each room. The host will have the ability to boot members that are being stupid and the ability to transfer host control to another leader.

This system needs to kick major butt: stable and powerful. I'll be running it on a pretty powerful server (2 Clovertowns ) so my application server should be able to handle this. I'm looking at having upwards of 2000 chats running at the same time. Sounds ambitious, but I'm a worst-case-scenario kind of guy.

I've run through multiple tutorials (esp. the one on Kirupa.com) and this is the code I've come up with. It works but it has absolutely no user-login or tracking. It works fine on my localhost server, if I pull up two flash windows, it communicates just fine. Here is my php and chat codes, I don't think I need to attach the .bat file:
PHP CODE:

Code:
#!/usr/bin/php -q
<?php
//#!/usr/bin/php -q = SUPRESSES HTTP HEADERS AND DEFINES THIS AS A SOCKET

error_reporting(E_ALL);

set_time_limit(0);

ob_implicit_flush();

$address = '127.0.0.1';
$port = 9999;


//---- Function to Send out Messages to Everyone Connected ----------------------------------------
function send_Message($allclient, $socket, $buf) {
foreach($allclient as $client) {
$buf.substr_replace("tk","/me",0);
socket_write($client, "$socket wrote: ".$buf);
}
}



//---- Start Socket creation for PHP 5 Socket Server -------------------------------------
if (($master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {
echo "socket_create() failed, reason: " . socket_strerror($master) . "
";
}

socket_set_option($master, SOL_SOCKET, SO_REUSEADDR, 1);

if (($ret = socket_bind($master, $address, $port)) < 0) {
echo "socket_bind() failed, reason: " . socket_strerror($ret) . "
";
}

if (($ret = socket_listen($master, 5)) < 0) {
echo "socket_listen() failed, reason: " . socket_strerror($ret) . "
";
}

$read_sockets = array($master);

//---- Create Persistent Loop to continuously handle incoming socket messages ---------------------
while (true) {
$changed_sockets = $read_sockets;

$num_changed_sockets = socket_select($changed_sockets, $write = NULL, $except = NULL, NULL);

foreach($changed_sockets as $socket) {
if ($socket == $master) {
if (($client = socket_accept($master)) < 0) {
echo "socket_accept() failed: reason: " . socket_strerror($msgsock) . "
";
continue;
} else {
array_push($read_sockets, $client);
}
} else {
$bytes = socket_recv($socket, $buffer, 2048, 0);

if ($bytes == 0) {
$index = array_search($socket, $read_sockets);
unset($read_sockets[$index]);
socket_close($socket);
}else{
$allclients = $read_sockets;
array_shift($allclients);
send_Message($allclients, $socket, $buffer);
}
}
}
}
?>
*Note, I haven't run through this code and learned all of it yet. I'll get to that ASAP.

AS3 Code:

Code:
//REQUIRES TWO TEXTFIELDS ON THE STAGE, 'inputMsg' and 'msgArea', AND A BUTTON 'pushMsg'
package {
import flash.display.Sprite;
import flash.events.DataEvent;
import flash.events.Event;
import flash.events.IEventDispatcher;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;
import flash.events.SecurityErrorEvent;
import flash.net.XMLSocket;
import flash.text.TextField;
import flash.xml.XMLDocument;

public class SocketTest extends Sprite
{
private var XMLS:XMLSocket;
private var TextF:TextField;

public function SocketTest()
{
XMLS = new XMLSocket();
ConfigureListeners(XMLS);
XMLS.connect("localhost", 9999);

pushMsg.addEventListener(MouseEvent.CLICK, pushMessage);

msgArea.htmlText = "Flash is trying to connect...";
}

private function ConfigureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.CONNECT, SOCK_Connect);
dispatcher.addEventListener(Event.CLOSE, SOCK_Close);
dispatcher.addEventListener(DataEvent.DATA, SOCK_Data);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, SOCK_IOError);
dispatcher.addEventListener(ProgressEvent.PROGRESS, SOCK_Progress);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, SOCK_SError);
}

private function pushMessage(e:MouseEvent):void {
if(inputMsg.text != "") {

var xml:XMLDocument = new XMLDocument();
XMLS.send(obj.message);
inputMsg.htmlText = "";
}
}

private function SOCK_Connect(e:Event):void {
msgArea.appendText("
FLASH HAS SUCCESSFULLY CONNECTED TO THE SERVER");
}
private function SOCK_Close(e:Event):void {
msgArea.appendText("
THE SERVER CONNECTION HAS BEEN LOST");
}
private function SOCK_Data(e:DataEvent):void {
msgArea.htmlText += e.data;
}
private function SOCK_IOError(e:IOErrorEvent):void {
trace("IO Error Event");
msgArea.appendText("<b>FLASH HAS ENCOUNTERED AN ERROR</b>");
}
private function SOCK_Progress(e:ProgressEvent):void {

}
private function SOCK_SError(e:SecurityErrorEvent):void {
trace("Security Error");
msgArea.appendText("<b>FLASH HAS ENCOUNTERED A SECURITY ERROR.</b>");
}

}
}


Now I don't know what the best thing to do would be... either have one centralized server that rocks the world or have a server for every category ( I don't want to rebuild a server 100+ times... please don't make me do that...). However, I'm pretty sure that xml and php would be the best way to go for me. And yes, I HAVE looked into Unity and Parsley, though I'm still a bit unclear on how to use Parsley.

So basically what I need is a solution to all of this. Has anyone developed a chat system that accommodates all of this and is easily modifyable by a Flash and PHP Developer? I've looked into so many different engines, from FlashChat to FlashPioneer. They all suck and are made for Joe Average user who wants a nifty application on his site. Does anyone know of any tutorials or solutions to what I'm talking about? I'm pretty good in PHP and I have no problem with AS3 and Flash at all.

What should I do? I'm limited on time and I need to get this sucker running ASAP. Anyone?

- TK

XML Socket Server
I need a XML socket server program (just like the title says) for serving dynamic information to Flash clients. The program must be able to sustain a load of over 500 (1000 or above prefered) continous connections. The flash application is a online multiplayer RPG. The program must be free as my group is a non profit organization.

Thanks for your time

PHP + XML Socket Server
Hey everyone,
I'm looking for either a tutorial or a completely done server. Here's what I have so far: I have over 100 different "worlds" on my website that each need to have a subdirectory of chat rooms.
IE: quote:PHP DEVELOPMENT (category)
--->Socket Servers(room)
--->MySQL Integration(room)
--->Random Talk(room)

AJAX DEVELOPMENT(category)
--->Nifty XML(room)
--->Not detergent(room)

TK DEVELOPMENT(category)
--->What you can do to help(room)
--->TK is an endangered species(room)
--->Save the TK Fund(room)
--->That guy is weird(room)
--->Open Discussion or something like that(room)


The categories are predefined by a database I've got. Users need to be able to create a chat room in a category, and I need to be able to list all rooms out in a category so users can chat in rooms relevant to their subject. The engine needs to interpret the messages and send the messages to the right chat rooms and categories. I'm assuming that I'll be needing to print out XML so that flash can interpret it or the like. Each user will be carrying a variable that determines what category they are browsing so when they come to my chat 'page' they'll see all the open chats running in their current subject as well as all the categories so they can change to a different category if need be.

I also need certain functionality. Users need to be able to whisper to one another, and there will be a host (chat-starter) for each room. The host will have the ability to boot members that are being stupid and the ability to transfer host control to another leader.

This system needs to kick major butt: stable and powerful. I'll be running it on a pretty powerful server (2 Clovertowns :) ) so my application server should be able to handle this. I'm looking at having upwards of 2000 chats running at the same time. Sounds ambitious, but I'm a worst-case-scenario kind of guy.

I've run through multiple tutorials (esp. the one on Kirupa.com) and this is the code I've come up with. It works but it has absolutely no user-login or tracking. It works fine on my localhost server, if I pull up two flash windows, it communicates just fine. Attached are my php and AS3 codes, I don't think I need to attach the .bat file.

Now I don't know what the best thing to do would be... either have one centralized server that rocks the world or have a server for every category ( I don't want to rebuild a server 100+ times... please don't make me do that...). However, I'm pretty sure that xml and php would be the best way to go for me. And yes, I HAVE looked into Unity and Parsley, though I'm still a bit unclear on how to use Parsley.

So basically what I need is a solution to all of this. Has anyone developed a chat system that accommodates all of this and is easily modifyable by a Flash and PHP Developer? I've looked into so many different engines, from FlashChat to FlashPioneer. They all suck and are made for Joe Average user who wants a nifty application on his site. Does anyone know of any tutorials or solutions to what I'm talking about? I'm pretty good in PHP and I have no problem with AS3 and Flash at all.

What should I do? I'm limited on time and I need to get this sucker running ASAP. Anyone?

- TK







Attach Code

PHP CODE:

#!/usr/bin/php -q
<?php
//#!/usr/bin/php -q = SUPRESSES HTTP HEADERS AND DEFINES THIS AS A SOCKET

error_reporting(E_ALL);

set_time_limit(0);

ob_implicit_flush();

$address = '127.0.0.1';
$port = 9999;


//---- Function to Send out Messages to Everyone Connected ----------------------------------------
function send_Message($allclient, $socket, $buf) {
foreach($allclient as $client) {
$buf.substr_replace("tk","/me",0);
socket_write($client, "$socket wrote: ".$buf);
}
}



//---- Start Socket creation for PHP 5 Socket Server -------------------------------------
if (($master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {
echo "socket_create() failed, reason: " . socket_strerror($master) . "
";
}

socket_set_option($master, SOL_SOCKET, SO_REUSEADDR, 1);

if (($ret = socket_bind($master, $address, $port)) < 0) {
echo "socket_bind() failed, reason: " . socket_strerror($ret) . "
";
}

if (($ret = socket_listen($master, 5)) < 0) {
echo "socket_listen() failed, reason: " . socket_strerror($ret) . "
";
}

$read_sockets = array($master);

//---- Create Persistent Loop to continuously handle incoming socket messages ---------------------
while (true) {
$changed_sockets = $read_sockets;

$num_changed_sockets = socket_select($changed_sockets, $write = NULL, $except = NULL, NULL);

foreach($changed_sockets as $socket) {
if ($socket == $master) {
if (($client = socket_accept($master)) < 0) {
echo "socket_accept() failed: reason: " . socket_strerror($msgsock) . "
";
continue;
} else {
array_push($read_sockets, $client);
}
} else {
$bytes = socket_recv($socket, $buffer, 2048, 0);

if ($bytes == 0) {
$index = array_search($socket, $read_sockets);
unset($read_sockets[$index]);
socket_close($socket);
}else{
$allclients = $read_sockets;
array_shift($allclients);
send_Message($allclients, $socket, $buffer);
}
}
}
}
?>

AS3 Code:
//REQUIRES TWO TEXTFIELDS ON THE STAGE, 'inputMsg' and 'msgArea', AND A BUTTON 'pushMsg'
package {
import flash.display.Sprite;
import flash.events.DataEvent;
import flash.events.Event;
import flash.events.IEventDispatcher;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;
import flash.events.SecurityErrorEvent;
import flash.net.XMLSocket;
import flash.text.TextField;
import flash.xml.XMLDocument;

public class SocketTest extends Sprite
{
private var XMLS:XMLSocket;
private var TextF:TextField;

public function SocketTest()
{
XMLS = new XMLSocket();
ConfigureListeners(XMLS);
XMLS.connect("localhost", 9999);

pushMsg.addEventListener(MouseEvent.CLICK, pushMessage);

msgArea.htmlText = "Flash is trying to connect...";
}

private function ConfigureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.CONNECT, SOCK_Connect);
dispatcher.addEventListener(Event.CLOSE, SOCK_Close);
dispatcher.addEventListener(DataEvent.DATA, SOCK_Data);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, SOCK_IOError);
dispatcher.addEventListener(ProgressEvent.PROGRESS, SOCK_Progress);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, SOCK_SError);
}

private function pushMessage(e:MouseEvent):void {
if(inputMsg.text != "") {

var xml:XMLDocument = new XMLDocument();
XMLS.send(obj.message);
inputMsg.htmlText = "";
}
}

private function SOCK_Connect(e:Event):void {
msgArea.appendText("
FLASH HAS SUCCESSFULLY CONNECTED TO THE SERVER");
}
private function SOCK_Close(e:Event):void {
msgArea.appendText("
THE SERVER CONNECTION HAS BEEN LOST");
}
private function SOCK_Data(e:DataEvent):void {
msgArea.htmlText += e.data;
}
private function SOCK_IOError(e:IOErrorEvent):void {
trace("IO Error Event");
msgArea.appendText("<b>FLASH HAS ENCOUNTERED AN ERROR</b>");
}
private function SOCK_Progress(e:ProgressEvent):void {

}
private function SOCK_SError(e:SecurityErrorEvent):void {
trace("Security Error");
msgArea.appendText("<b>FLASH HAS ENCOUNTERED A SECURITY ERROR.</b>");
}

}
}

Xml Socket Server ...
Does anyone know how I can set up a local xml socket server on my pc to test with the xmlSocket object in flash. I'm running WAMP.

Thanks.

In Need Of A Socket Server
Well, since my webhost has some very limited features, I've decided to move my chat pages to my webserver. I also have devided to implement XMLSocket into my project. First, I tried making my own socket server using PHP (man, what a joke that was! It's like an architect fixing a broken pipe ). Then, I, well wait a second, nevermind. To the point, I need a stable, free (notice the bold) socket server with slighly adjustable source code, and is easy to set up. I am not very much of a tech person besides in Flash and PHP. Other than that, there isn't really too much I know about computers (well, mabey I know a little ). I've gotta stop rambling on, thanks in advance!

Xml Socket & Web Server
Hi.

I am trying to publish a flash page in IIS to the local network on the same subnet and then use the xml socket function to connect to a winsock server on the same machine as IIS resides, on that machine i can do this by using 'localhost' but i cant seem to connect from the remote machine. This is some of the code I am using: -

serverip = "192.168.0.2";

serverskt = 10101;

sock = new XMLSocket();
sock.onConnect = onSockConnect;
sock.onXML = myOnXML;
sock.connect(serverip, serverskt);

I have tried various ways of doin this, like:-

serverip = "http://flashserver/";
serverip = "http://192.168.0.2/";

But none of these work, as anyone any suggestions?

Thanks


Mark

Who Will Host A Socket Server?
I've been searching around the forums for the last day or so, looking into XML socket server options again. I've read someXML FAQs, downloaded and run a few of the java based options locally, even installed a jabber server and had a great time talking to that over telnet...

What nobody seems to address though, is WHO will host a multiuser socket server once it is done, nor even what to look for in a host; does Servlet/JSP support neccessarily mean they will allow a socket conection for example? How about SSH?

Running a java enabled webserver from my home system is not an option, the upload speeds here (Australian ADSL) are barely above a 56k modem.

Also, cost is an issue. This is not for profit, I'd like to make a multiplayer game that is playable for free, and don't want to pay more than 'standard' web hosting fees (currently paying $8/mo).

So, if you have a socket based game hosted by an established web hosting company, please tell me who the hosting company is, what they allow you to run, how much I can expect to pay, and what limitations they set (bandwidth, number of simultaneous connections etc.)

Alternatively, If you are one of those who runs an XML socket server from their home for their own flash games and you feel like donating a port...

This is something I've been meaning to find out for a long time. Any help greatly appreciated, thanks.

Socket Server :confused:
Hi Forum,
Where i can find the VB/JAVA/C# code or tutorial for Socket server that would support xmlsocket client Flash movie like this one :
THIS IS THE LINK
Thanks in advance

XML Socket Server Recommendation
I am looking to purchase a stable XML Socket Server that can run on a Windows 2003 Server. Does anyone have any recommendations?

Communication Server and Electroserve are way out of my budget.

Thanks.

A Reliable XML Socket Server
can anyone recommend a good socket server?

Choosing An XML Socket Server
This seemed to be the most appropriate place to post...

I am trying to figure out what XML Socket Server to use for a game that is under development (DB and back end is designed - flash development is beginning). Please discuss your experiences with various XML socket servers. I am developing a game with similar specs to a poker game (content is XMLizable ;-)). Also - please recommend dedicated server hosts you have experience with.

Flash Socket To Irc Server
Hi !
I have developed an application under Flex Builder3 & framework flexlib using socket ( binary socket ) to connect to an irc server , and everything working okey !
when i try the application(swf in html page) on my pc it work very wel

when i depoloy it on my webhosting it work but no connection to irc server!
could u plz help me ?

Server Socket Creation In AC3
I am new to Action Script 3. There are ways to create socket client in Action Script 3 to communicate with a TCP server on the other side, which is lintening for request from clients, using flash.net.socket, etc. That is, Flash aplication will be Socket clients here. But, I would like to know wthere there is a way to create a similar TCP server sockets in Flash itself , listening for requests from other socket clients. Either directly usign Action Script or using other libraries.

Server Socket Creation In AC3
I am new to Action Script 3. There are ways to create socket client in Action Script 3 to communicate with a TCP server on the other side, which is lintening for request from clients, using flash.net.socket, etc. That is, Flash aplication will be Socket clients here. But, I would like to know wthere there is a way to create a similar TCP server sockets in Flash itself , listening for requests from other socket clients. Either directly usign Action Script or using other libraries.

Can't Afford Socket Server
If you cannot afford a socket server and want to support a massive amount of people chatting and playing multiplayer games on Flash, what would you do? Should I use PHP/MySQL? Would that put too much strain on it and make it slow?

PHP 5 Socket Server Question
I went through this tutorial...

http://www.kirupa.com/developer/flas...ets_flash8.htm

A couple of weird things happened. First of all it worked perfectly... which doesn't make sense because I only have PHP 4, not PHP 5. And also, I have no access to a command shell or a way to run a BAT file like it says in the tut.

The way I got it to run was by going to the file in the browser. Somehow this magically started the endless process that the socket server needed.

My question is, since I have no access to a command shell, how do I get the socket server to stop running? is there some kind of linux command line I can run through a php script?

thanks!

Socket Server Bandwith...?
I just got done building a local socket server for multi user in Flash....(GO ME!!!)... however, I am unaware of bandwith usage... does any have an idea on how to find out the bandwith usage??????

I am sure I am doing this the wrong way... but I am sending data to the socket server on an onEnterFrame (so every xx fps)... is this bad? I am sure I am not too sure so that is why I am asking here. Thanks!

PHP / AS3 XML Socket Game Server
I wrote a XML Socket server in PHP recently because I wanted to make a multiplayer Flash game in AS3. This server is supposed to be completely generic and doesn't have any game logic. You should be able to build pretty much any game with this server.

While writing it I realized the new version for Flash Player 9 r115 had some new security issues surrounding Sockets. So I implemented a crossdomain.xml and modified the XML Socket server to serve a crossdomain.xml file if it encounters a security request. The security policy socket server runs on 843 always (it's the default port flash player looks at).

Along with the PHP Socket server I wrote an XML Socket client in ActionScript 3 (AS3). This set of classes is also completely generic and is completely event driver. Your game client would include this file and pass it parameters through the Events classes in order to communicate with the socket server.

Lastly I created a very simple game / prototype using the AS3 class and PHP server. It is very basic, each player gets a ship, and can move around and shoot at other players. However I implemented all of the funtions: Logging in, Logging off, Synchronising players and movements, creating objects (ie firing a bullet), etc

This code is open source and can be used completely free of charge. Please let me know if you've found it useful or used it anywhere.

Lastly if you are a designer or programmer and have an idea for a multiplayer web based game, please contact me.

If you have any issues with the code or if you'd like to ask me some questions, don't hesitate to email me.


More info / code: http://www.kilometer0.com/socket_server.php

Flex PHP Socket Server
I want to test a simple PHP socket server with Flex, server seems to work fine when trying to test using telnet, but Flex doesn't display any responses, here's my code:

server root has the following files:

socketserver.php

PHP Code:



#!/usr/bin/php -q<?php     print "Starting Socket Server...
";     $host = "127.0.0.1";     $port = "45654";     $max_users = 4;     set_time_limit(0);     $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);     socket_bind($sock, $host, $port);     socket_listen($sock, $max_users);     $childSocket = socket_accept($sock);    $incomingData = socket_read($childSocket, 2048);     if (substr($incomingData, 0, -2) == "respond") {         $response = "Server Response > I am here!
";         socket_write($childSocket, $response, strlen($response));     }     socket_close($childSocket);     socket_close($sock); ?>




crossdomain.xml

Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" to-ports="45654" />
</cross-domain-policy>
ActionScript code:

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
private var server:String = "127.0.0.1";
private var port:Number = 45654;
private var socket:Socket;
private function init():void {
socket = new Socket();
socket.addEventListener(Event.CONNECT, onConnect);
socket.addEventListener(Event.CLOSE, onClose);
socket.addEventListener(ErrorEvent.ERROR, onError);
socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
socket.addEventListener(ProgressEvent.SOCKET_DATA, onResponse);
Security.allowDomain(server);
Security.loadPolicyFile("http://"+server+"/crossdomain.xml");
try {
socket.connect(server, port);
outMessage("Trying to connect to "+server+":"+port);
} catch (error:Error) {
socket.close();
outMessage(error.message);
}

}
public function send(string:String):void {
socket.writeUTFBytes(string);
socket.flush();
}
private function onConnect(event:Event):void {
outMessage("Connected to "+server+":"+port);
send("respond");
}
private function onClose(event:Event):void {
outMessage("Connection closed");
}
private function onError(event:IOErrorEvent):void {
outMessage("Connection error");
}
private function onIOError(event:IOErrorEvent):void {
outMessage("I/O error");
}
private function onResponse(event:ProgressEvent):void {
var string:String = socket.readUTFBytes(socket.bytesAvailable);
outMessage(string);
}
public function outMessage(msg:String):void {
log.htmlText += '<font color="#000099">'+msg+'<br>';
}
]]>
</mx:Script>
<mx:TextArea id="log" width="400" height="200" x="10" y="10" selectable="false"/>
</mx:Application>
I'm using Ubuntu 8.04 and I run the socketserver.php using terminal
for testing:
$telnet 127.0.0.1 45654
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
respond
Server Response > I am here!
Connection closed by foreign host.

but the output swf only displays:
Trying to connect to 127.0.0.1:45654

any idea why?

Flash Socket Server
Im working with a friend on a flash Idea I had, part of that required me making a php based socket server which is done, It has some modifications to support our needs however I was wondering if I should take it a little further.

I know there are a couple out there but the ones I saw where not cheap for commercial use ( half the reason I built my own ) and not to easy to expand ( the other half ) expect for one if you knew java which I just dont enjoy using.

Basically just trying to figure out if its worth my time to go beyond what I have now, and what features people might want If I do move further with this project.

Flash Socket Server
I am looking for some people to help test a php xml socket server, I have one working version and am in the middle of recoding a more improved version.

I need some people interested in using the current version for testing, and giving me there input on load handling

Once I am done with my new version I will want some opinion on that as well.

Also looking for someone extremely familiar with flash to work on projects based on this server.


( Note, not a standard socket server.. Can not be used with most socket enabled flash chatrooms without some minor changes )

Currently going from a single process model to a multi-process/forked model.

A single process model is fine for basic chat, however once you get into more complicated applications it does not balance well.

Bluetooth API (Socket Server) ?
Hi!

Been looking for a while a way to use bluetooth in AS3. Would like to connect to a bluetooth GPS and fetch coordinates. No luck yet with either api's or tutorials. Anyone have a clue?

Maybe have to write a socket server for the bluetooth communication, but most is done i M$ were I not feel like home. Maybe there are some solution for PHP, Ruby or Java (Only a bucket full of skills there).

Anyone tried anything of this earlier?

C# XML Socket Server And Flash.
Hello,

I have created a basic c# server that sends a string to the flash xmlsocket object. I can connect but my onData function is not firing. Is there something special i need to do with my code? Thanks

Code:

var url:String = "127.0.0.1";
var port:Number = 5000;

socket = new XMLSocket();
socket.onData = function(msg)
{
   trace("data has been received from Socket "+msg);
}
socket.onConnect = function (success) {
   if (success) {
      trace("
XML Socket Connection Connected
");
   } else {
      trace("
XML Socket Connection Failed
")
      
   }
}
socket.onClose = function(){
   trace("
XML Socket Connection Has Closed
");
}
socket.connect(url,port);

Multiuser Flash Socket Server
Hello there.
Ok I wonder which server to choose.
I need to develop multi-user application and game and I don't know which server I should choose between those
Sushi
SmartFox
ElectroTank

If you know another socket server for realtime multiuser, pot them as well

So any feedbacks one those, whatever you heard, could be great
Thx

Socket Server Not Running? :confused:
Here's my socket server (of course it would throw an error because it's already been run once and there could be only 1 instance running at the same time (unless of course on different ports).

http://dragonplay.us/beta/socket_server.php

and here is the chat room I'm working on:
http://dragonplay.us/beta/chat.swf

I don't know, maybe I'm posting this in the wrong place, but here is the problem:

I upload the php and the swf to the server and set the php to be executable. Then, I opened the php file, and it stuck. After that, I opened the swf, and it threw a "can't connect!" error. You can go to the swf and see what happens. I'm pretty sure that the server is running because when I tried to refresh the php, it threw an error saying that the ip and port is already in use.

Methods Usage For Socket Server
Hi, i am using IIS server. my database are in SQL Server. i want to use sockets to connect to IIS, but how am i going to use the methods from the webservice.asmx file in ASP.NET?i am using visual studio 2005.
here is my code for connecting to the IIS:

my ASMX Url: "

XMLSocket Connect To PHP Socket Server
So.. I don't typically have too many problems I can't solve myselfbut this one is really stumping me. I have my WIndows 2003 Server R2 SP2 running a PHP Socket script as a service. I also have a Flash 8 Application that's running an XMLSocket connection to this PHP socket script. Alright. My server is a webserver as well. I have the .swf file sitting in an .html file on my server that's running the php socket server.

When I access the file locally on my computer or a computer on the network, I have no problem connecting to the PHP Socket Server and everything works great. However, whenever I try to access the file via an internet address.. www address, that is when it won't connect correctly. I have the global permissions set to allow access from that .swf file and I have the folder to allow script access as well. What am I doing wrong?

It just seems weird to me that it won't allow the connection when doing via internet on the local network but it will allow me to run straight off the files on a local drive. I've looked for a while now and my eyes are getting weary from viewing all the different possibilities and none of them work. Has anyone had a problem similar to this and found a solution?

Flex - Python Socket Server
Quote:




note: this is my second post regarding to the same security issue, here is my first post:
http://www.kirupa.com/forum/showthread.php?t=314465
many thanks to scottc & ViktorHesselbom for their respons, I took their notes in my consideration and here is my new issue using python instead of php socket server.




I need to establish a binary socket connection between flex and python socket server, but I keep receiving the following error in flex:

Error #2048: Security sandBox violation
http://localhost/test/bin/test/swf cannot load data from 192.168.1.208:12321

I'm [as client] running on openSUSE 11, and I have flash debugger installed following this article:
http://www.adobe.com/go/strict_policy_files
And my server is running on ubuntu 8.04

The only issue I've noticed that when I comment the following ActionScript line in test.mxml:

Security.loadPolicyFile("xmlsocket://"+host+":"+port);

I receive the following error in policyfiles.txt:

Quote:




OK: Root-level SWF loaded: http://localhost/test/bin/test.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://192.168.1.208:12321 by requestor from http://localhost/test/bin/test.swf
Warning: Timeout on xmlsocket://192.168.1.208:12321 (at 3 seconds) while waiting for socket policy file. This should not cause any problems, but see http://www.adobe.com/go/strict_policy_files for an explanation.
Error: Request for resource at xmlsocket://192.168.1.208:12321 by requestor from http://localhost/test/bin/test.swf is denied due to lack of policy file permissions.




Otherwise there is no errors produced in policyfiles.txt:

Quote:




OK: Root-level SWF loaded: http://localhost/hafez/bin/hafez.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://192.168.1.208:12321 by requestor from http://localhost/test/bin/test.swf




Please HELP!
My testing files as follows:

Flex Client: test.mxml

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
private var host:String = "192.168.1.208";
private var port:Number = 12321;
private var socket:Socket;
private function init():void {
Security.allowDomain(host);
Security.loadPolicyFile("xmlsocket://"+host+":"+port);
socket = new Socket();
socket.addEventListener(Event.CONNECT, onConnect);
socket.addEventListener(Event.CLOSE, onClose);
socket.addEventListener(ErrorEvent.ERROR, onError);
socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
socket.addEventListener(ProgressEvent.SOCKET_DATA, onResponse);
try {
socket.connect(host, port);
outMessage("Trying to connect to "+host+":"+port);
} catch (error:Error) {
socket.close();
outMessage(error.message);
}
}
public function send(string:String):void {
socket.writeUTFBytes(string);
socket.flush();
}
private function onConnect(event:Event):void {
outMessage("Connected to "+host+":"+port);
send("respond");
}
private function onClose(event:Event):void {
outMessage("Connection closed");
}
private function onError(event:ErrorEvent):void {
outMessage("Error "+event.text);
}
private function onIOError(event:IOErrorEvent):void {
outMessage("I/O "+event.text);
}
private function onSecurityError(event:SecurityErrorEvent):void {
outMessage("Security "+event.text);
}
private function onResponse(event:ProgressEvent):void {
var string:String = socket.readUTFBytes(socket.bytesAvailable);
outMessage(string);
}
public function outMessage(msg:String):void {
log.htmlText += '<font color="#000099">'+msg+'<br>';
}
]]>
</mx:Script>
<mx:TextArea id="log" width="400" height="200" x="10" y="10" selectable="false"/>
</mx:Application>
Server Master Policy File: crossdomain.xml

Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*" to-ports="12321"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
Server Apache Snippet: .htaccess

Code:
<Files crossdomain.xml>
ForceType text/x-cross-domain-policy
</Files>
Python Socket Server: socketserver.py

Code:
#!/usr/bin/python

import sys
class case_selector(Exception):
def __init__(self, value): # overridden to ensure we've got a value argument
Exception.__init__(self, value)

def switch(variable):
raise case_selector(variable)

def case(value):
exclass, exobj, tb = sys.exc_info()
if exclass is case_selector and exobj.args[0] == value: return exclass
return None

def multicase(*values):
exclass, exobj, tb = sys.exc_info()
if exclass is case_selector and exobj.args[0] in values: return exclass
return None

import socket
class MirrorServer:
"""Receives text on a line-by-line basis and sends back a reversed
version of the same text."""
def __init__(self, port):
"Binds the server to the given port."
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind(port)
#Queue up to five requests before turning clients away.
self.socket.listen(5)
print "listening to " + str(port) + "
"
def run(self):
"Handles incoming requests forever."
while True:
request, client_address = self.socket.accept()
#Turn the incoming and outgoing connections into files.
input = request.makefile('rb', 0)
output = request.makefile('wb', 0)
l = True
try:
while l:
l = input.readline().strip()
try:
switch(l)
except case("respond"):
output.write("running" + '
')
except case("date"):
output.write("getDate" + '
')
except case("check"):
output.write("update" + '
')
except case("exit"):
request.shutdown(2)
except case(l):
output.write(l + '
')
except socket.error:
#Most likely the client disconnected.
pass

if __name__ == '__main__':
import sys
if len(sys.argv) < 3:
print 'Usage: %s [hostname] [port number]' % sys.argv[0]
sys.exit(1)
hostname = sys.argv[1]
port = int(sys.argv[2])
MirrorServer((hostname, port)).run()

Flash And A Visual Basic Socket Server?
Hi guys,

Could someone please explain how i would do this. (im trying to understand socket servers)

Have a flash file (swf) on a website with a textbox.
When somone enters "hello" in the text box, it passes it to my visual basic application, and the VB app displays the enterd text in a listbox.

Did that make sense? lol.

I really dont know how to start this - i just want to see how flash and visual basic can work together.

I know that the flash file needs to be on my own server (which it is), i just carnt understand this part: flash runs client side, as it needs to download, so how can it pass varibles back to the server.

What do xml files do?

Any info would be great. I know about electrosever, and that java is a better socket server etc, i just want to use vb for this project im trying to work on.

Regards.

Flash Xml Socket Through Proxy Server - At College
Hi, I have made a java socket server end for my flash game www.tbadventure.com but i am having connection problems whilst at college (which operates via a proxy server)

The java socket server operates on port 81 and at college if I type http://myipaddress:81 i can access direct to the socket server, however in flash this simply fails and I get a connection error at college. (at home or on any other pc I have tried it works fine)

Is this a setting in flash? can I change this setting with coding if so? Could it just be a security setting on the college server (regardless of whether i can access my server through the browser or not?)

flash player 9 is installed on the system at college.

thanks in advance for any help,
Attilio

[F8] Server(php) Client(flash) Socket Problem
hi,

I have an actionscript_2/flash problem. My application is based on the client-server model and uses stream sockets to acquire communication between the users(clients) and the server.

On the server side, I have a php script running in a linux server. Here is the base of the server code:



PHP Code:




//---- Start Socket creation for PHP Socket Server
  
if (($master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {
myecho( "socket_create() failed, reason: " . socket_strerror($master) . "
", 0);
}
  
socket_set_option($master, SOL_SOCKET,SO_REUSEADDR, 1);
  
if (($ret = socket_bind($master, $address, $port)) < 0) {
myecho( "socket_bind() failed, reason: " . socket_strerror($ret) . "
", 0);
}
  
if (($ret = socket_listen($master, 5)) < 0) {
myecho( "socket_listen() failed, reason: " . socket_strerror($ret) . "
", 0);
}

/*Create Persistent Loop to continuously handle incoming socket messages*/

while (true) {
    //....inside here server executes socket_accept(), socket_recv()
    // and sends messages to client with socket_write()
} //while forever






On the client side, i have a browser (for example, ie or firefox) which runs an swf file written with actionscript 2 in flash 8. The example code of the client follows:



Code:
var host:String = "my.host";//it's an example ...
var port = 9998; //example again...
var socket:XMLSocket = new XMLSocket();

socket.connect(host, port);
onEnterFrame = function() {
socket.onData = function(msg) {
switch (msg) {
case 1 : //do sth in case 1 etc....
//.....
break;
}
}
}


On the server side, I have no problems. The server receives and sends all the messages correctly (on real time).

On the client side, the browser(client) sends all messages correctly and right on time! But, the serious problem is the client's receive!!!

Assuming the two clients communication case. When the two clients interact continuously, the messages transfer is normal. But when a client stays inactive (not sending messages) for a while, then the next messages a client sends, will be send to the server but the other client will no receive anything! The messages are not lost and will be received all together after a not specific period of time from the client.

I guess that the problem is on the client side and it's about browser cache or there is sth wrong with the



Code:
socket.onData = function(msg){...}

which is paused without a specific reason!!!

I would appreciate anybody's help, whether he/she has faced a similar problem or not.

Flash Xml Socket Through Proxy Server - At College
Hi, I have made a java socket server end for my flash game www.tbadventure.com but i am having connection problems whilst at college (which operates via a proxy server)

The java socket server operates on port 81 and at college if I type http://myipaddress:81 i can access direct to the socket server, however in flash this simply fails and I get a connection error at college. (at home or on any other pc I have tried it works fine)

Is this a setting in flash? can I change this setting with coding if so? Could it just be a security setting on the college server (regardless of whether i can access my server through the browser or not?)

flash player 9 is installed on the system at college.

thanks in advance for any help,
Attilio

Kirupa Tutorial On Php Socket Server And Flash 8
Hi,
I was reading the tutorial, which gave information on getting the socket server running with a .bat file; does anyone know a way to get it running on linux? (linux doesn't run .bat files)

I read about shell scripts, but I don't quite understand how to get it running.

Thanks,
-Danny

Opensource Basic Flash Socket Server
Releasing this basic socket server for people to use with Flash chat rooms.

http://forums.cyberlot.net/viewforum.php?f=1

Making A Chat App- Cannot Connect To Socket Server
Hi

Okay I've downloaded an xml socket server which I have uploaded to my site. Now I'm trying to create a simple chat program using an example that came with the socket server. My problem is that I cannot connect to the socket server. What do I need to do?

this is the what I've got so far:



code:--------------------------------------------------------------------------------function Connect() {
Output = "Connecting... please wait";
ChatSocket = new XMLSocket();
ChatSocket.onConnect = ConnectCheck;
ChatSocket.onXML = PackageRecieved;
ChatSocket.Host = "www.connectgames.co.uk/Temp/ChatTest/";
ChatSocket.Port = 1025;
ChatSocket.connect(ChatSocket.Host, ChatSocket.Port);
}

function ConnectCheck(Connected) {
if(Connected) {
gotoAndStop(2);
}else {
Output = "Failed to connect";
}
}
--------------------------------------------------------------------------------

when I call the function connect it always fails. As the host I've put the full path of the location of the socket server. I've tried just using 'www.connectgames.co.uk' but that didn't work either. You can check it for yourself here:

http://www.connectgames.co.uk/Temp/ChatTest/Chat.html

Can anyone help me?

thanks in advance

Connecting To An Ftp Server With Binary Socket -aarghh
Hi,

I'm trying to make a little ftp upload app - not a full FTP client, just something to enable image upload with decent performance. I basically took the approach Lee used in his POP3 socket tutorial. The problem I'm having is that I can connect to the FTP server and I can authenticate and log in but as soon as I try to enter passive mode for data transfer I get nothing- not even an error. From looking at the FTP RFCs, FTP requires two TCP connections - a command connection and a data connection - does this mean that I need to open a second socket for the data transfer?
Another possible issue is the Flash Player security policy not allowing conection to ports under 1024 - I have not placed a policy file or policy server on the host running the FTP server but as I can successfully login, I appear to be able to connect to port 21 (standard FTP port) anyway...weird?
The code I'm using is:

Code:

var s:Socket = new Socket("ftp.actechnology.co.uk",21);
var ftp_response:String;

s.addEventListener(ProgressEvent.SOCKET_DATA, receiveReply);
s.addEventListener(IOErrorEvent.IO_ERROR, showError);

s.writeUTFBytes("USER my_username
");
s.writeUTFBytes("PASS XXXXXXXXXX
");
s.writeUTFBytes("CWD /public_html/
");
s.writeUTFBytes("PWD
");
s.writeUTFBytes("PASV
");
s.writeUTFBytes("LIST
");
s.flush();

function receiveReply(e:ProgressEvent):void{
   ftp_response = s.readUTFBytes(s.bytesAvailable);
   trace(ftp_response);
}
function showError(e:IOErrorEvent):void{
   trace(e);
}

If anyone can shed some light on why passive mode kills it or has successfully connected to a FTP server with the socket class, I'd love to hear from you - cheers all.

Making Flash Talk To A Php Socket Server
Hi there,
I've hovered around with php before, and have used it a fair bit, but I'm pretty new to Flash.
I still have hope of building my own socket server in php eventually, but following some early failure with that idea, I thought I'd just try and get the basics going for now. I'm now using patServer as the framework.

Having convinced my host to open up a port for me on the firewall (actually, they were very understanding and opened me up a few hundred of 'em), I began experimenting. I started off, as you do, by stealing the example as best I could, and doing very little work. The Telnet chat worked fine through Telnet, with the minor exception that you couldn't see what you were typing as you typed, and you were able to do weird things to your name when deleting part of your message. But I'm rambling.

Normally, I wouldn't expect to just take an example written for use with Telnet and expect it to work with Flash. The thing is, it almost does. This chat-type applet I've got now successfully reports that it's connected, then proceeds to ignore everything you do. It doesn't even send the welcome message from the server. Similarly, the connection is picked up in the browser through which the php socket's been kicked off, but subsequent messages/commands fail to get through at all. Okay, so that doesn't work, right? Nope. When you kill the applet, about to throw your head into your hands and question the terrible injustice of life, the socket suddenly receives all the information you tried to send when the app was running, and tells you how it's sent all the appropriate responses back. A little late, if I may say so. They even came through on another client running with Telnet... but only when the app was closed.
Hoping it was really simple, and that it worked a little like local variable storing (where I believe you have to flush it to make it happen before the app dies), I tried adding the line
socket.flush();
to my Actionscript, where socket is the imaginatively named socket connection I've created. No such luck. It still fails to work.

My Actionscript in the main window is thus (I should point out that most of this is stolen/adapted from various helpful tutorials):

Code:


socket = new XMLSocket;
socket.onConnect = function(success)
{
if (success)
chatarea_txt.htmlText += "<b>Server connection established!</b>";
else
chatarea_txt.htmlText += "<b>Server connection failed!</b>";
}
socket.onClose = function()
{
chatarea_txt.htmlText += "<b>Server connection lost</b>";
}
XMLSocket.prototype.onData = function(msg)
{
chatarea_txt.htmlText += 'Message: ' + msg;
}
socket.connect("[The server's IP]", [The appropriate port]);

function doconnection(connectionStatus){
connectionStatus ? trace("Connected.") : trace("Connection failed.");
}



The 'Send' button is blessed with the following:

Code:


on(release)
{
texttosend = messageinput_txt.text;
messageinput_txt.text = '';
socket.send(texttosend + '
');
//socket.flush();
}



I have a feeling I'll get similar problems should I try to develop anything more complex on the server side. This smells like an issue with my Flash to me. Any thoughts on what I may have done wrong would be greatly appreciated.

Multiplayer Game / Socket Server Template - How To Structure?
I am working on what I hope becomes an excellent starting point for Flash developers who want to make a multiplayer game. The basic idea is that I want to create a project like AMFPHP which is easy to set up which provides the basic building blocks for socket communications between online users connection from different machines. Minimally, it would consist of a socket server written in PHP (intended to run as a daemon) and Some Flash and Actionscript components to connect to the script using XMLSockets or perhaps even binary sockets.

What is the best format for the Flash part of this project? Should I create a flash file or should I create some Actionscript includes that dynamically create login elements, windows, etc. Most multiplayer games start with a game selection interface which is much like AIM or ICQ or some other chat program. For instance, my sample client currently requires 3 frames: login/nickname selection, game view and selection, and then the game itself. As it stands, my flash project contains quite a bit of Actionscript...should I move this to an Actionscript file? Is it possible to create a component that can simply be dragged into the library of an empty flash project?

I'm sure there are other questions I'll have but this is at least something to start with.

Issue With Binary Socket Policy File On A Server
I have a unique problem, I am attempting to setup a binary socket connection between flash running on my desktop and a Rabbit RCM3800 Microcontroller providing the server on my home network, which has no file system and has a very basic http server on it.

Due to limitations of the microC I cannot run Java/Perl/Python or any other server on it other than setting up a server using its own native Dynamic C language (essentially manually opening and controlling sockets in C). I am able to successfully connect to a socket on port 3333 of the server and transfer information between the server and the .swf file when it is the sandbox type "local-trusted" (while I'm debugging in Flash). Because of this I'm fairly certain the code to setup the socket between the server and flash works fine.

My problem occurs when I try to run the .swf file as "local-with-network" (such as running it after publishing on my desktop) or "remote" (accessing the .swf file when it is located on the server) and it then requires a socket policy server to host a socket policy file on the server. On my server I have code setup such that whenever a socket opens on port 843 or port 3333 (my data port) and sends a stream of raw data containing the request <policy-file-request/>, the server writes back in ASCII the below code and closes the socket.

Code:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>


The flash SECURITY_ERROR property returns:

Code:

securityErrorHandler: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048: Security sandbox violation: file:///C:/myProg.swf cannot load data from 192.168.1.59:3333."]

I also have logging setup on my system, and the policyfiles.txt logfile displays:

Code:

OK: Root-level SWF loaded: file:///C:/myProg.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://192.168.1.59:3333 by requestor from file:///C:/myProg.swf
Warning: Timeout on xmlsocket://192.168.1.59:843 (at 3 seconds) while waiting for socket policy file.  This should not cause any problems, but see http://www.adobe.com/go/strict_policy_files for an explanation.
Warning: Timeout on xmlsocket://192.168.1.59:3333 (at 3 seconds) while waiting for socket policy file.  This should not cause any problems, but see http://www.adobe.com/go/strict_policy_files for an explanation.
Error: Request for resource at xmlsocket://192.168.1.59:3333 by requestor from file:///C:/myProg.swf is denied due to lack of policy file permissions.

So for some reason flash times out while waiting for the socket policy file. I have tested sending the <policy-request-file/> over telnet, and have received the above policy file. I have also sniffed using wireshark and saw that my desktop sent the policy request and received the policy file. I am guessing that Flash times out because it is waiting for some kind of terminating character that states the end of the policy file, and to that end I have tried sending

and .

Interestingly, instead of sending the policy file I have tried sending random data from the server to flash, and flash displayed the Warning: Ignoring policy file at (URL) due to incorrect syntax. Because I don't receive this warning when I send my policy file I don't think it is formatted incorrectly. I have also tried using the below flash code to hold the socket request open indefinitely, but it also errors after 20seconds.
Code:

Security.loadPolicyFile("xmlsocket://192.168.1.59:843");

The .swf file will eventually reside on the server itself at 192.168.1.59/myProg.html. I have only tested the flash file remotely on the server a couple times, and in addition to the previous warnings/errors, I received the warning: SWF from (URL) may not connect to a socket in its own domain without a policy file.

If anyone has any idea what my problem could be I could really use the help! I can also post my flash code or my server code to help figure out what the issue is. Thanks!

-James

Page 2 - Making Flash Talk To A Php Socket Server
Yup, I have my php server file running and its outputting to the command line and not a browser. You just run the file ./filename.php and the first line of code defines where my php executable is:

!#/usr/local/bin/php

right now its just sitting there "Listening for clients..." but never gets a connection when I use flash.

Rollon And Rollout Unity
im creating a webpage where i have 5 buttons. when you rollover one button, it scales up and the other buttons scale and move in reaction to the first button.

when you roll off they go back to their original position.

now if you were to rollover to button 2, the same thing would happen.

my problem is my buttons hop around because when you mouse over button two before button one is finished animating back to its origingal position, itll hop to the frame button two told it to. this creates a choppy project because they arent relating to eachother.

is there an "if" statement or something, that i can say, "if button1 is animating, wait for button1 to finish before proceeding with button2's animation".

that way i can mouse over button1. itll do its thing, ill mouse off button1 to button2, button1 can finish its rollout animation before button2 performs its animation.

Smilies - DynPos / Unity Chat
Hello peeps,

Interesting one for ya - I think so anyway...

Got a Flash chat app - running on Unity. It's looking good and working nicely. However, I would like to integrate smilies so the user clicks an icon and the text version of the smilie is added to the input text [they could enter it by hand if they wanted].

Then, when they send the text and it is displayed in the chat box the correct smilie should be visible at the point in the text that they entered it. i.e. I need to dynamically position a smilie in a single variable text box [using a non monospaced font] so they appear in the text where they were added in the input field.

Hard I know but a challenge!

Cheers for you ears,

Sam and the Elektonika crew.

Copyright © 2005-08 www.BigResource.com, All rights reserved