Flex :: Actionscript 3 - Flex Socket And Erlang Socket Communication
Jun 29, 2011
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.
View 2 Replies
Similar Posts:
Jul 15, 2010
I use C# to read a string (BinaryReader.ReadString()) from the socket stream. But the problem is that flex doesn't writes the string in suitable format, so C# will be able to read that. C# reads a 7 bit encoded integer which indicates the length of the string, and just then reads the string. But flex doesn't writes a string in this format (I use socket.WriteUTF(), and even socket.WriteUTFBytes() didn't work), so C# can't read the string. Here's a little information of how C# reads/writes a string from a socket stream:
[URL]
View 1 Replies
May 19, 2011
I have a Flex AIR app, and i am trying to get data from a Java Server. Can some one tell me if this approach will work?
Start a ServerSocket in Java and wait for a connection. Use Flex to connect to the same port. Write some data to the socket from Java Server. Read the data at the Flex end and process it.
I think i am able to get this working, but the data that i read back at Flex end seems to be empty.
My server code is :
socket = new ServerSocket(port);
client = socket.accept();
InetAddress address = client.getInetAddress();
[Code].....
My current problem is socket.bytesAvailable becoming 0 and therefore obj is coming up as "". So how to read data sent from the server using a Socket in Flex?
View 1 Replies
Nov 27, 2010
I'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]...
View 2 Replies
Oct 27, 2011
when using Socket class to make connection with server, how actionscript transform data to server with different language implementation? The server may implement in .NET, ruby, or java, the following is the code example:
[Code]...
when I use java implements the server side, why and how actionscript "know" the way to communicate with java(what if using .NET implements the serverside), does it mean actionscript "clever enough to know the server side language?". what if write customer object to socket(and how), and server responds to actionscript. Could anyone explain the mechanism or recommend some material about these topic?
View 1 Replies
Dec 22, 2008
I wonder how can i flush the data to the server while somedata was downloading with a single socket instance
View 1 Replies
Mar 6, 2012
I have some software developed where I have setup good communcation between some VB software and flash software. Communication is done locally via socket connection. I was hoping I could do the same except with two swfs. Who acts as the host? do I need a host?
[Code]....
View 1 Replies
May 12, 2011
I have a socket server listening on 2 ports, 1 port for the socket server and 1 port for the policy server. My code is below, in this scenario, data is sent and received perfectly fine. however, for example if I add a button with a simple:
socket.writeUTFBytes("Message");
socket.flush();
after the initial connection, it doesn't seem to send any data to my server (I have my server printing all data transmissions to the console for checking) Initial connections work fine, as seen below:
[Code]...
View 1 Replies
Nov 19, 2011
When I send number (int)52 s.Send(BitConverter.GetBytes((int)872415232));, flash show me trace(socket.readInt()); 872415232 If i send 872415232, flash show 52.Why? And how it fix?
View 1 Replies
Apr 28, 2010
I am trying to connect to a socket server from flex. I read, on adobe's documentation, the client automatically sends a "request-policy-file" xml element to the socket before allowing it to be opened, and should receive a policy file.
The client sends the xml element as expected, My server receives it (on the port I want to use, port 6104) and replies on the same port with:
[Code]...
View 1 Replies
Dec 30, 2010
I have a Flex web app (compiled to regular SWF) that tries to connect to a (binary, not XML) socket on its own server. So if the swf is at [URL], the socket is [URL] This should be possible, AFAIK, but when I try to connect I get a security error saying that [URL] cannot access [URL]. Even though it shouldn't be needed, I also have a crossdomain.xml file containing
[Code]...
View 2 Replies
May 18, 2011
In what situations should i use Socket class or XMLSocket when trying to connect from Flex to a Java Server that is going to listen to a port?
View 1 Replies
Nov 28, 2008
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:[code]
View 4 Replies
Mar 7, 2010
How to play mp3's from socket connections in Flash AS3?
I have some simple programm which is listening to some port (TCP).
I connect to it using as3 sockets and it starts sending me mp3 data
How to play that data?
View 1 Replies
Apr 9, 2010
I'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 Replies
May 18, 2011
I'm currently trying to communicate between java and flex by using sockets and AMF serialized objects.
On the java side I use Amf3Input and Amf3Output from BlazeDS (flex-messaging-common.jar and flex-messaging-core.jar).
The connection is correctly established, and if i try to send object from flex to java, i can easily read objects :
FLEX side :
protected function button2_clickHandler(event:MouseEvent):void
{
var tmp:FlexAck = new FlexAck;
tmp.id="123456789123456789123456789";
[Code]....
View 2 Replies
Jun 1, 2011
I am migrating an application from flex sdk 3.4 to flex sdk 4.5.I am using a telnet example of AS3 tutorials as base to construct a generic socket class that implement a specific protocol.The main problem is that the new application with the validated socket class does not fire any event (no error - no connected - no data - nothing). The try catch with the connect method does not throw any error. I checked if the events were successfully connected, but they are not fired never.Update: I used the suggestions to modidy the code. Actually, now I am receiving an error on the security policy.
This is the constructor:
public function GenericSocket(server:String, port:int, output:TextArea) {
// set class variables to the values passed to the constructor.
[code].....
View 1 Replies
Sep 29, 2009
import flash.events.*;
import flash.net.XMLSocket;
import flash.system.Security;
[Code]....
I want to implement flex web application using Socket connection. But I am getting sand box violation error for remote sites in sample application . It is working fine in local.
Error:
Security Sandbox Violation
Error: Request for resource at xmlsocket://170.21.8.0:4000 by requestor from http://localhost/Sample/DotNetSocketConnect.swf is denied due to lack of policy file permissions.
View 1 Replies
Feb 1, 2010
Would Director be an option for creating a socket client? My client needs to accept server commands; frame rate, start etc.Director seems like it was made for controlling movies. I've got Director 11.5 at the office.
Interaction with client
SERVER==>XML PACKET==>CLIENT==>swf plays on given frame and duration
[code].....
View 1 Replies
Feb 12, 2010
I am writing a peer-to-peer binary socket program. There are only two endpoints. One socket is listening on my laptop system. The other socket is broadcasting from my desktop system. I have a third program running on a hosted server, that is available to broker the connection between the two. My problem is that when the laptop and desktop are on the same network, they both have the same internet IP address but different intranet IPs, but when the laptop is on the road, then the IP addresses are different. In order to be truly peer-to-peer, I have to write it so that after the connection is established, that the two computers communicate directly between one another. How is this generally accomplished, when the two computers could potentially share the same IP address, if they are running on the same network?
View 1 Replies
May 12, 2010
I am using a Socket (not xmlSocket) connection between flex applications and the server pushing messages.Now, when I connect from the local machine to the server everything is working file and running, connection is succesful and I get data back and forth.When I upload the application (flex) to the server and run it from there, I get a security sandBox violation message.Note:1. I do have a crossdomain file with * wildcard both on port and on domain.2. I created a Securiy.allowDomain("*") as well.Another thing.I also created another listener on that same server, listening to connections for port 843 (default) and this service just waited for a connection send policy file to the client and that's it.
View 3 Replies
May 17, 2010
I'm trying to evaluate whether Flex can access binary sockets. Seems that there's a class calles Socket (flex.net package). The requirement is that Flex will connect to a server serving binary data. It will then subscribe to data and receive the feed which it will interpret and display as a chart. I've never worked with Flex, my experience lies with Java, so everything is new to me. So I'm trying to quickly set something simple up. The Java server expects the following:
DataInputStream in = .....
byte cmd = in.readByte();
int size = in.readByte();
byte[] buf = new byte[size];
in.readFully(buf);
[Code] .....
After that - EOFException happens on the server and that's it. So the question is, am I approaching whole streaming data issue wrong when it comes to Flex? Am I sending the policy file wrong? Unfortunately, I can't seem to find a good solid example of how to do it. It seems to me that Flex can do binary Client-Server application, but I personally lack some basic knowledge when doing it. I'm using Flex 3.5 in IntelliJ IDEA IDE.
View 1 Replies
Aug 20, 2010
I 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 Replies
Dec 3, 2010
I am running a socket server using PHP. The socket server runs fine because I can connect to it using PHP.Now, I have a flash application that is trying to connect to it:
this.socket.addEventListener(Event.CONNECT, onSocketConnect);
this.socket.addEventListener(Event.CLOSE, onSocketClose);
this.socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);[code]....
When I run the application locally, it works! However, when I upload it to my server I get a sandbox security error (#2048). The flash app is actually hosted on the same server as the socket server, and there is cross domain policy file in place.
View 3 Replies
Feb 22, 2011
How to understand binary data transferring between flash client and server? How do rtmp-servers work? How is video transferring between server and client? What's the difference between using Socket and NetConnection? Is rtmp-server just a socket server supporting amf serialization? I'll be very happy, if someone explains me these aspects.
View 1 Replies
Sep 27, 2011
I have created a flex app that uses sockets. I published the flex app in a web application that runs on glassfish server. Now from that flex app i create a socket connection to a C# server and start sending/receiving data.The problem is that after i create the socket connection to C# server the flex app first checks the policy file, and after it get's it, it closes the socket, without keep the connection alive.[code] Now after i create the connection and it gets the policy from server it closes this socket, so to be able to use this connection i have to call again [code]After i do this, i can use normally the connection
View 1 Replies
Apr 2, 2012
I'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]....
View 1 Replies
Jul 16, 2009
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]...
View 1 Replies
Apr 27, 2010
i got a problem with 'Security error',it happens when i try to connect my XMLSocket (Flex) with my Socket (Java)i have a domain:
alucardeck.mine.nu
i startup my apache tomcat 6.0 and in ROOT folder i have:
policyFile.xml and crossdomain.xml
(i had a doubt about what is the correct filename so i created both)both files contains:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
well, yes, you can access using the default port 80, as it should be.(but probably my server will be down when u try to access it)so here is what i do: i run my Java server application.there i open 1 socket in port 19809.(i already tried with port 843 too) then, i run my Flex application: [URL]also i tried to run it in ROOT folder..the XMLSocket class is instanced like this:
xmlsock = new XMLSocket();
// add all listeners
Security.loadPolicyFile("http://alucardeck.mine.nu/crossdomain.xml");
// also tried "xmlsocket://alucardeck.m....
[code]....
i also notice when i start my Java Server application with 2 sockets listening ports: 843 and 19809, i notice Flex first try to connect to 843 and then 19809, and in both sockets i reply with that String from before.
View 1 Replies
Apr 5, 2012
I am having an issue with sockets where the data I'm sending is getting truncated on the client side (Flash/Flex). The data that is sent by my server is full and in tact, but flash does not wait the appropriate amount of time before firing an event saying to read the data. This results in the data not getting fully read and (as such) I can't parse the object out of it after that. We are exploring the possibility of stripping the object into smaller chunks, but the idea is for it to be as lightweight as possible so we would much rather get it to work the way it's supposed to than patch in a temporary solution.I'm not entirely sure if referring to it as the receive 'buffer' is correct, as some computers are able to receive all of the data and others are having it truncated (which means the buffer is adequate but flash isn't waiting the appropriate amount of time to dispatch the event for whatever the reason).
View 1 Replies