ActionScript 2.0 :: Flash Directly Use Sockets?
Oct 29, 2006
As the title says, I would like to know if Flash 8 or any version of flash can access sockets.For instance like winsock does. Using an IP and a port to send packets? I've seen it can connect to databases, but I haven't seen anything with it working with sockets, for instance a P2P chat using only an IP and a port to send an receive messages.
View 1 Replies
Similar Posts:
Nov 5, 2009
I am not any kind of network programming pro, but it happened that I have faced necessity to develop socket-server on php (no way for using Java) for flash multiplayer browser-game (standard features like locations, team battles, etc).
The main problem is that TCP is point-to-point protocol and it completely occupies given port.Of course it is possible to create some kind of queue, which will manage connections to the socket, but this solution doesn't seems to be the fittest one.
It seems to me that using interval of "fair" ports (from 2000 to 2200, for example) is more fitting solution, because one request may take a lot of time to execute and players won't be happy to wait in queue.
But how can I implement this "port inteval" strategy?The solutions that I see are:
launcing php-script per every port (he-he, 2 hundreds of launched scripts!);somehow forking the initial process to new processes (2 hundreds of processed? Not nice too), one for every port;additional while-loop, which listens all the ports (looks very bad);using threading or something like that (the problem is that php is single-threaded, as far as I know; pcntl?).But somehow I don't like any of them, or at least don't know how to implement them in the best possible way.
What is the best existing strategy to handle multiple requests from multiple users per time unit without delays, and how to implement this strategy in php? We have our own Debian-server, so it is possible to use any required php extensions.
For example, if we are trying to develop chat application, we need some sort of fixed (I mean persistent) connections for each user. For example, we have 80 users in chat, and then one of them posted a message, which server tries to handle and send to all other connected users, also putting an entry to the history file or something like that.
In this situation polling server for new messages every 10 seconds from each of 80 users is craziness, so the need in persistent connection gets obvious.But I don't know what is the best way to implement something like this, considering that not all requests are handled instanlty.
View 2 Replies
Mar 26, 2011
I was trying to write a stress tester for my own protocol when I stumbled up on this problem.Anytime I create more than 4 connections from one PC Flash denies to receive anymore messages from the server although I'm still able to connect, and write messages.
View 1 Replies
May 11, 2011
What WebSockets add to raw TCP connection?Why should I use WebSockets?I'll have only Flash clients, no need to support Javascript clients.
View 1 Replies
Mar 2, 2011
I have two (+) systems on a local network running an AIR application that need to send/receive updated positions and other events between each other. I'm currently using an AIR-based socket server one of the instances. The AMF and strong typing works great. What doesn't, however, is the syncing between clients.
In my example below, clientA is trying to send an AMF packet to clientB. The SOCKET_DATA events fire off as expected on the server, in sync with the mouse, however the data that clientB receives very quickly gets out of sync and events are lost.
It's fine if an occasional event gets dropped, however I need to know the most recent SOCKET_DATA event has the latest data. Instead, it just contains increasingly older data.
Code Snippets:
clientA writeObject: (on MOUSE_MOVE to test large number of events)
protected function stage_mouseMoveHandler ( pEvent : MouseEvent ) : void
{
[code]....
View 1 Replies
Jan 21, 2003
it may be a stupid question what i'm going to ask, but i'll ask anyway ... just had an idea... is there a way i can comunicate through sockets in flash mx?
View 2 Replies
Feb 10, 2010
i'm trying to develop a multiplayer game in AS3, but i don't know how to use the sockets, how to set up my server, actually i don't know how to start, i want to build a peer to peer game, which will have a "room" to find players, it will be a cars game, i already have all the rest of the game, i just need to be able to make it multiplayer
View 3 Replies
Sep 20, 2010
I read about a project that enables the developer to program a HTML5 web sockets application that is compatible with older browsers by automatically falling back to using a flash method.
View 1 Replies
May 12, 2011
doing a project where the deviceorientation-data from smartphones get transfered to a socketserver, and from there to a flash-application.Now creating a http-server with nodejs wasn't too hard, and connecting from a smartphone via browser and transfering the data with socket.io worked fine.The problem comes with flash, i couldn't manage to connect my flash application to the http-server running socket.io. I figured out when i run a node tcp-server connecting from flash is no problem, but i have no more session management and i can't connect from the browser anymore.
View 1 Replies
May 20, 2011
I have a program in c++ that sends a socket of 23723 bytes to a flash player in one "shot".The flash player sometimes receives two packets of size 17520 and 6203, and other times it receives a single packet of 23723.
EDIT: There does not seem to be a way to obtain the total number of bytes associated with the send data from flash. This would make it very difficult to build a loop to reconstruct the "broken" packet.I thought TCP was supposed to correctly recombine the packets and I am having difficulty recombining them myself.This is my receiving handler in flash:
var socket:Socket = new Socket();
socket.addEventListener(Event.CONNECT, socketConnectHandler);
socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataReceivedHandler);[code]...
will at times print 23723, and at other times, will print 17520 quickly followed by 6203. The total size are just examples and are subject to change for each send sockets. Also many sockets can be sent or received at the same time, so the split packets can be inter-mixed. In c++ I could determine what the total size of the sent data was, even if I did not receive the whole sent data yet.
View 2 Replies
Oct 5, 2009
how to connect Flash to a server Using Sockets connection using in AS3.
View 16 Replies
Jan 11, 2011
Has there been any word on when the output progress event is being implemented? At the moment flash sockets are useless at uploading anything other than basic text files or maybe images because we are unable to control the amount of data being sent. The way I see the output working at the moment is when trying to send large files, the input buffer becomes flooded and in the process of trying to transmit so much data at the same time, many packets are lost. I tested this by trying to transfer a 570mb AVI to an ftp server. By the time it got there the file was only 37mb. The event would allow us to calculate the network speed of the system doing the uploading and the speed of the server doing the downloading so that the buffer size and intervals can be optimized.
View 1 Replies
Dec 20, 2010
I am attempting to connect to a python twisted socket server with Flash using XMLSocket. The connect works fine, and so does the receive. However I can't send data to the server. Is there a specific format I should be using? The reason I ask is because I couldn't read any data with the XMLSocket until the data was in the form "something", that is, the data string had to be valid xml followed by the null character. Is there a trick to sending data?
I don't think this a cross site security problem, because if it was, I believe I wouldn't be able to connect or receive. I am able to connect to the server using telnet and a java client without issues. EDIT: I figured it out, the problem was my server needed to have the data sent to it end with"
View 1 Replies
Jul 4, 2011
I want to a framework to pass objects between Java and AS3 using sockets. It should be something with good performance (not XML, JSON). I have looked into AMF but all of the tutorials are very complex and not about what I need. I have used java to java serialization but I can't find any tutorial about Java to AS3.
View 4 Replies
Oct 17, 2010
I'm bothering with Java-Flash communication. At the beggining, I used XML Socket Class, which was pretty easy to implement and my aplication comunicated very well.However, my program will monitor behavior of many users at the same time, so parsing and sending large xml files could overload Server. Thats why I used Socket class and AMF coding instead. After tough hours of implementing it, whole application seemed to work. Unfortunently, after couple of tests it apeard, that Socket was slower than XML Socket! I have no idea why, because in theory binary messages should be much faster than xml. Could you help me solving this issue? Below I pasted my code for both Java and AS3.
This code sends basic variables from class object and are received the same way (it can sound bit complicated compared to just sending whole object, but for various reasons is the only way).
1. Java client (java server receives data from different sources and sends it to flash):
Code: public void sendMyPosition(MyPositionMessage message, Socket sock) throws IOException
{
synchronized (sock) {[code].....
2. Flash server - new data triggers socketDataHandler which receive it with readReasponse function. First int describes which kind of message was send, although there is only one at the moment. I've deleted some handlers couse they seemd irrelevant this case. Whole AS Class is attached as a file.
Code:
public class CustomSocket extends Socket {
private var currentMessage:int = -1;
private var message:Object = null;[code]................
View 1 Replies
Oct 6, 2010
I've contacted Adobe sales and tech support, and realized that I need to talk to someone who actually develops with these tools.I want to develop some simple graphical widgets with the ability to reload themselves via an xml-socket a couple of times a second. Which Adobe tool should I buy-- Flash Builder, or Flash Pro?
View 1 Replies
Dec 21, 2009
it seems that Flash was supposed to run in a sandbox in the browser. But, if Flash can get data from a remote server, can it similarly get data from localhost IP on the same machine? In other words, can I use a Windows app that provides a TCP socket on localhost to feed data into a Flash app?the answer is yes at least for the case of an SWF file hosted in the file system, URL...(turns out the localhost access error can be fixed if you add the SWF app to some security whitelist). Still wondering if this can also be done for SWF apps hosted on the network.
View 1 Replies
Dec 1, 2009
I'm creating a Flash IRC client for a project, and it works fine locally. However, when I place the SWF on a server it returns the #2048 error. I've tried to load in a policy file with no luck.
View 9 Replies
Jul 11, 2010
I've benn trying to get a simple socket server test to work for days now and it seems I'm not getting very far.Basically I just want to send some data from flash to the php script and have it echo it out, or anything at all like that I've been working from this tutorial http[url]....I have this basic flash class which just sends a string to the server:
Code:
package{
import flash.net.XMLSocket
import flash.display.MovieClip[code]...
The server side php is the attached script (pretty much this http:[url]....So I keep the php running on my server then run the as class, what happens is after a while (presumably the 15 second script limit in as) I get this error:
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: .../networking.swf cannot load data from website.com:9980.at base()
View 1 Replies
Apr 20, 2011
I'm using flash sockets to build an embedded chat application. everything works great. I want to allow all the sites who embedded this application to connect to my server, except for some sites.
My problem is that the number of sites that I don't want to connect to my server is a very large one( 4-5k). Currently from what I seen all you can do is tell in your policy file the domains that you allow/not allow.
What I'm looking for is a way for flash player to send me the domain where the flash is embedded and I could return an accept/decline response. I know I can send info about the site where the flash is embedded using actionscript, but this can be very easy simulated.
View 1 Replies
Jun 28, 2010
This is driving me nuts and because it's a combination of various technologies together I have a hard time tracking the problem. I wrote a tiny HTTP server that serves .flv files; these flv files are encoded on the spot. The flv files are encoded with adobe's screencodec (I started with libflv but that was too buggy so I ended up implementing my own flv encoder). For the problem below it doesn't matter which codec I use or if I serve plain flv files instead of on-the-spot generated ones (the problem also occurs if I just send 12 h264 encoded files).
I also have a swf that I coded in as3. The as3 opens 12 connections to my server and requests 12 different flv's and just displays them as 12 different videos on the page. I tested the setup with Firefox and chrome and am using the latest flash client (version 10). The HTTP server is pseudo streaming those files; e.g. it tells the client the file is of mime type video/x-flv, tells the filesize is 2GB and just starts streaming. For sake of completeness here's a header it generates:
[Code]....
View 1 Replies
Mar 20, 2002
Is it possible to put javascript directly into flash??? And if so, how?
View 14 Replies
Dec 12, 2009
Still learning Flash (using Koolmoves 7.0) but seem to have a grasp...BUT! I am having a serious issue with trying to have a button launch a javascript. Here is my code below:
[Code]....
If anyone wants to see what I WANT it to do please go to [URL] If you click on the "read" the floatbox launches. The pictures just go directly to the page instead of a floatbox
View 1 Replies
Dec 26, 2006
[URL]
my website is flash-only and i have photo gallery, and if you click on a thumbnail it loads larger image in flash, and then you can click on it and see "Save As..." dialog.. you can find a nice example what i am talking about here [URL] and if you select one photo there is "DOWNLOAD IMAGE" :] it's not my web.
View 2 Replies
Dec 8, 2009
Can Flex objects be referenced and used in AS3 in Flash? I tried to make a Button from the fl.controls but it said Button nolonger exists and I need to use SimpleButton, and that it didn't recognize the package I was refering to, fl.controls. I tried again with the Colorpicker since I thought part of the problem might have been the button, and I thought I had referenced fl.controls incorrectly since I tried to use fl.* the first time, similar to using flash.display.* and flash.events.* It had the same problem, though, and now I'm wondering if it's even possible to use the flex controls directly. I can't imagine why, though; they're a part of the FlashPlayer runtime, so if I'm calling them from Flash or Flex it shouldn't matter, right?
View 4 Replies
Oct 28, 2010
I need to read the contents from the browser's cookie.I tried to use FlashVars to pass the contents from html to flash.However, the contents of the cookie may change after the swf is loaded.So I need to setup a listener to read the cookie directly.
View 4 Replies
Apr 22, 2012
I want to change .as to use directly in my flash actions. How to change the following line with blue text?
public class Main extends MovieClip
{
var xml:LoadingXML;
[code]....
View 1 Replies
Apr 11, 2011
I would like to know if it's possible to capture a users webcam in flash and directly upload it to YouTube without a backend server setup. Or if there are any third party providers that support this service. I see YouTube offers a live streaming API, but it seems it's only available for selected users.
View 1 Replies
Apr 20, 2010
I'm heads down working with the FlashBuilder tool which is heavy AS3, and have used Flash CSx for years. My question: I'm assuming my AS3 skills that I develop with FlashBuilder will be directly applicable to Flash CSx, correct? I understand I'll need the context of applying my AS3 code to the Flash objects when working in Flash CSx but for the most part will my AS3 skills carry over from FlashBuilder to Flash CS4/5?
View 3 Replies
Dec 16, 2009
Just wondering if there is any way to access the serial port directly in adobe flash ?
View 2 Replies