ActionScript 3.0 :: Flex PHP Socket Server
Nov 28, 2008I 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:[code]
View 4 RepliesI 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:[code]
View 4 RepliesI'm building a Flex application, which is going to perform many server requests (let's say, that almost all interactions require an update from server). At the moment I'm using remote procedure calls for it. But I was wondering if using a socket would be better. In other terms, is maybe better to keep the connection alive rather then performing many calls in sequence? For my demo app I only have 1 client. Is the number of clients connecting to the server a factor for this choice?
View 1 RepliesI am writing a online game with flex and java server and I have a big problem. In normal case, my game run smoothly but some time the clients can't receive the command from server. I found that if server send message too fast or client is doing something when server send message, the game client can't detect for a new message so my game is freeze. I only tested with 4 clients and I don't know what happen when thousands clients online in the same time. So terrible :(. In the game client, I use one EventDispatcher class to dispatch any command from the server. Do you have any solution to warranty that client must receive any message from server when the connection is still alive or server must know if client received the message or not. I use flex 3 with Socket (binary) and Java QuickServer.
View 1 RepliesI'm trying to create an app that multiple users would log into a server hosted over the local network. When testing the app in Flash Builder it connects, but when I run it on my phone it does not. I'm using XMLSocket like so:
[Code]....
Actionscript Socket Policy File Server Problems Has anyone been able to successfully implement a service to serve the required socket policy file to FlashPlayer?
[Code]...
I'm trying to get my Flash application to connect via socket to my server, so I need to set up a socket policy file server. It seems like there are various roll-your-own implementations floating around out there, but is there any kind of standard or best practice with what to use?
As an aside, it seems strange that Adobe imposes this restriction but doesn't make something readily available to support it.
i want to know how to send data using the AMF format from my flex AIR project to a socket written in Java. I am getting CorruptedStreamException when sending data using writeUTFBytes() methods. Has anyone experienced similar problems? Also can AMF be used only if i am using LCDS only?
private SimpleServer(int port)
{
System.out.println(">> Starting SimpleServer on port " + port);
[code].....
Ok, basically my Flex app will open up a socket and listen on it. My java program will write some string to this port.
My AS3 code is
private function onRecvClick():void
{
var host:String = "localhost";
[Code]....
While trying to write to the socket, i am getting this java.net.ConnectException: Connection refused: connect. Funny thing is that the socket in Flex doesn't seem to dispatch any events, is it normal for that to happen?
I'm creating a client-server game. My client is a flex based game, and my server is erlang server. At the beginning, when I test directly my flex client in flash player, I can establish a connection easily to my erlang server through socket connection. And both can exchange data with no problem. The problem rise when I deploy my flex app at Apache http server, and running it using a browser by calling [URL] my flex socket sends message requesting for a crossdomain policy to my erlang server. So I create an xml message that represent a crossdomain policy, and send it back to my flex app as a response for that request.
Yet still I can't establish any permanent socket connection between my flex client and my erlang server. I know this because I add listener on my flex socket that will modify its internal state to CONNECTED, if a connection between client-server has established.
I am working on the web base flash application I am trying to communicate with server through binary socket to the server through IP Address and Port using Action script 3.0 at the server side we are using java. I will like to send binary data string to the server in a clubbed single packet. I dont know the Action Script 3.0 as much.for this We will have to communicate through IP and Port only
View 1 RepliesI'm working on a flash MMO with a c# server. I have a simple messaging protocol for the sockets. When a client joins he sends out this:
[Code]...
I have made a socket server in C# for a flash game that I am developing, I got the code from somewhere and I am a beginner in c# and .net development . It works fine in practice when connections are made and the server functions correctly. Get 2 concurrent connections at the same time and we have a problem. here is the basic aspects of the socket server below: (alot taken out for obvious reasons) how can I alter this so that it can handle concurrent connections? Should I be threading each response?
[Code]...
I'm writing socket server in java for my flash browser based game and i need to connect to mysql database. Is it possible to connect to mysql through socket server and send received data to connected flash clients?
View 1 RepliesIf 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?
View 1 RepliesI 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
I'm trying to connect to a telnet server through a Socket.On that server, I setup a crossdomain.xml file:
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" to-ports="23" />
</cross-domain-policy>
[Code]...
I'm working on a small school project, and I'm grabbing video from my webcam like this:
camera = Camera.getCamera();
if (camera == null) {
Security.showSettings(SecurityPanel.CAMERA);
} else {
camera.setMode(960, 600, 30, true);
camera.setQuality(0, 100);
outgoingVideo = new Video();
[Code] .....
And I would like to now send this video to a server I am connected to using an XMLSocket. Is this possible?
I am wondering if it is better to write basic "chat" client based servers in java because then you can have multi threaded servers where clients can connect and chat or if you can do this in Actionscript- minus the multi threading because from what I know air and or AS3 do not support threading.
View 2 RepliesMy webhost has rules against socket servers so I've been looking into GAE.
Does anyone know of a socket server that can successfully run on GAE? I'm using it for flash so anything like smartfox would be amazing if it's possible.
I read through the method to connect to a socket server : [URL]. I wrote an AIR application to connect to the java server code, but the client cannot connect. What is missing in the code?
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="[URL]"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" backgroundColor="#D5F8C3">
[Code] .....
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. The code I'm using is:
Code: Select allvar 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);
[Code].....
why passive mode kills it or has successfully connected to a FTP server with the socket class
i am trying to develop a socket server with TcpListener in C#.it will accept XMLSocket from flash clients and eventually im trying to make a simple multiplayer enviornment.i've so far created a server.exe from c# that simply listens and accept the tcp connection, announce(only within the program yet, not to all clients) if the client is connected and announce when the client leaves.
it is working fine from flash IDE (when you ctrl+enter to test) but it is not working from the published swf file.i don't know much about server administration so i dont know if im doign it right but ive created a crossdomain.xml and save it to root of the localhost (im using apache installed on my machine for local testing);
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://localhost/socket.swf cannot load data from 127.0.0.1:8888.
at socket_fla::MainTimeline/frame1()
this is the error mesasge that i get from flash player 10, after its trying to communicate with the server(about 10sec, it shows).
System.NullReferenceException: Object reference not set to instance of an Object.
this is the error i get from the C# server. from catch{}.
Code:
//Flash File
//Security.loadPolicyFile("crossdomain.xml");
var socket:XMLSocket = new XMLSocket();
socket.connect("127.0.0.1",8888);
[code]....
I am working with flash CS4, compiling AS3 for Flash Player 9. So I use the class flash.net.Socket The main function is quite simple:
[Code]...
I have some asynchronous stuff going on in my Flash movie and would like to determine how much time elapses between two events -- e.g., a button click and the response from a socket server.
I'm wondering how to go about this in AS3?
Ok so I can send and receive XML nodes from the socket server I need to know how to take the nodes and the values within them.... like for example I want the X Y positions from the node sent to me from the server "<playerpos name="javageek1212" X="34" Y="23" />" Basically I want the values from within that node ok?
View 5 RepliesHas anyone been able to successfully implement a service to serve the required socket policy file to FlashPlayer?I am running the Python implementation of the service provided by Adobe at
[URL]
and using the following policy file:
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
</cross-domain-policy>
[code]....
I am trying to pass object to the server through socket connection in actionscript 3. What is the best way to do that?
is serialization better? or should I encode it first and then sent it as string?
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:
Select all<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "[URL]">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
[Code] .....
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. 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: Select allSecurity.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.
I've been thinking for a long time about working on a multiplayer game in Flash. I need updates frequently enough that ajax requests won't work so I need to use a socket server. The system will eventually have enough objects/players that I would consider it an MMO. I would like to set up a scalable system on Amazon's EC2. (Which probably effects my choice of server) This architecture would hopefully allow the game to grow without many changes over time. (Using a domain decomposition technique or something similar)
Heres my internal debate:Should I
a. Code my own socket server in C++ or Java?
b. Use the free and open source Red5 socket server for Flash?
or c. Pay the licensing fees and go for Electroserver?
I consider myself a decent developer, but am at an impasse as to what road to go down. I'm not sure if I, could develop/would need, the features of one of the prepackaged socket servers.
I'm also not sure if the prepackaged servers would work well in an Amazon EC2 environment and take full advantage of its features.
I am developing a chat server were my users log in using any of my clients applications with a very simple implementation of the TCP protocol. When the user logs into, the client sends a raw text to the server indicating some parameters like username, others, and the most important the WAN ip. This data gets stored on ther server database. After the execution of a algorithm who search for other online user in the database, the server sends to a pair of users the ip and the username of the other user, so later the clients can connect to each other directly wihtout using the server anymore. So, the server acts only like a meet point. Well all this works fine is the users arent inside of a private network, like a wireless router. The clients are programed in AS3 using XMLSocket and the server using VB6 with winsock.
View 1 Replies