AS3 :: C# - Socket / Server MMO Communication
Nov 27, 2010I'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'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'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.
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?
I wonder how can i flush the data to the server while somedata was downloading with a single socket instance
View 1 RepliesI 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]
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?
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]....
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]...
I can't find free version FCS distrib for Linux
View 3 Repliesthe chat client application is created using adobe AIR, the application should be able to do communication sims like Google Talk and AIM does. If it is impossible is there any other solution to do that?
View 2 RepliesI 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 RepliesCan i record audio without using a communication server in flash?
View 1 RepliesFor example, Flash records voice and sends it to the server where Java or C# apps can proccess it and return back some data (or write it to db). How this communication possible, which protocols sould be used and etc.
View 2 Repliesconnect to online web service to retrieve data using as2. while I am able to connect and send data successfully, I don't see the response. This is what I am trying to do:
[Code]...
i've recently created a demo of a flash game(AS3) for a client, in which the user hears a word and has to spell it correctly. the client wants the game uploaed to the web, where it will have to communicate with the server. the client's web developers outlined their desired flow for the process: users will go through a log in screen (html page), and fill in their username and password. after signing in, their details will be added to the url in which the flash movie is loaded.
flash has to be able to read the url and identifiy the user through it. additionally, flash has to recieve an xml with the current words the user will be played. finally, flash has to send the user's score back to the server. i've been developing flash bit by bit for about a year now, but this will be my first web project.
We're currently working on a small scale indie card game for Facebook, which we hope will reach hundreds of thousands of players (eventually). We have most of the issues figured out (scalability, server-side architecture, etc) - however one question - communication between client & server.
We have the following requirements:
Server side push messages (no client message request) High scalability (should support at first hundreds and later hopefully thousands of CCUs) Secure, reliable layer Work well with most computers, routers & browsers Works with Adobe Flash/AS3
First thing that came to mind was socket connections, but I was wondering, is there a better solution that answers our needs?
Need to find a way for Flash to talk to an ASP.NET server-side script and save some product information directly from Flash into a customer shopping cart...but, how are people handling this communication between Flash and the server-side C#? I want my Flash .swf to browse products and add them to the cart from within' Flash securely. Currently people can browse / Sort the products, but how are people passing information to the Flash movie securely? How are people handling information like session variables? What are people using to use Flash as their only interface tool for logging in, or accessing their account information through a Flash interface?
View 6 RepliesI 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 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 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'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 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]....