   UDP network in Flash 10 and C++
  Salutations,I am making a cute little RPG that has about 10-25 people per game. The client interface is in actionscript 3 and the server is run in C++. I think I know how to make it all (which is a scary thought for me, since I consider myself an artist) except for the networking system. I have been searching for months on this topic but have not had much success. The network libraries that are linked to from this site seem fine (not that I really know anything about networks, anyways) but I haven't a clue if they are compatible with both actionscript and C++ at the same time; or even just actionscript by itself.The closest thing I have found to what I am looking for is a tutorial at http://www.actionscript.org/resources/articles/604/1/XML-Socket-in-as3-/Page1.html ; unfortunately, it is for a TCP connection. Also, I remember finding this tutorial on a different website where some readers commented that it was not a very good idea.If someone could spare the time to walk me through this, that would be awesome - especially since I am rather slow when it comes to understanding code (even my own!). However, if you can only spare a few tips/insights, those would be valuable to me as well.P.S. I don't want to use libraries that fall under licenses like the GPL - when I make something, I like to have full rights to do what I like with it.   
  Are you referring to using RTMFP? I don't think that's been released yet. Is there a reason you don't want to just use TCP with Winsock or boost.asio or something?If you can, just use TCP with the flash.net.socket. There are examples in the documentation for a simple client. On the server side you'd be creating a socket server. When you have your client connect it will automatically send a policy file request it looks like <policy-file-request/> and you will respond on the server-side with a cross-domain policy file. (This is explained in the flash security white papers). You client will disconnect and your server should let it. Then it will make another connection but this time it won't send anything so you can have the client send something like "connected" or some binary message if you prefer and then you can communicate.Also there is no "compatability" thing. They're just sockets. If you specific questions ask them.   ;  As far as I can tell, flash.net.Socket is your best bet. However, it cannot do UDP; it can only do TCP. That being said, there's nothing wrong with TCP for most RPG-style games. World of Warcraft uses TCP, and they seem to be doing OK :-)Also look at the warning about security on the documentation page: you generally want to connect back to the same domain as the SWF file came from. If you serve your SWF from www.myl33tgame.com, then the game server also has to be at www.myl33tgame.com. This makes it harder to use content networks (like Amazon S3) to serve the Flash movie.;Quote:Original post by hplus0603Also look at the warning about security on the documentation page: you generally want to connect back to the same domain as the SWF file came from. If you serve your SWF from www.myl33tgame.com, then the game server also has to be at www.myl33tgame.com. This makes it harder to use content networks (like Amazon S3) to serve the Flash movie.Actually when you open a socket connection in flash and it sends the policy file. The server can be anywhere. You can have the socket server send the cross domain down the socket. You can even have the swf load files using another cross domain policy file for local files.(I have my client hosted on my webhost with all of its content in folders. It makes a connection to my computer which hosts the game. Works well.)//edit I didn't notice you said 'generally'. I'm not sure how that's a problem though. A quick fix would just be put a file in the directory and use a local policy file I guess that verifies it's hosted on the correct domain.[Edited by - Sirisian on June 24, 2009 7:33:42 PM];  Yes, you are right: with a policy file, you can let the game connect elsewhere.;  Wow, thank you for the quick and informative replies. Apparntly RTMFP is only in closed beta right now and you might have to buy Adobe Air for the server side to make use of it. Hopefully it will allow more then just UDP connections between clients (one would think so, but it isn't available yet so I can't check).One of my concerns is that TCP might not cut it as it is a PvP RPG - alot of PvP (Also, the terrain is editable to some degree). It is reassuring to hear that WoW uses TCP - though I've never played it before.Another question is if it is easy to switch to UDP when it comes out if TCP can't handle the load I put on it.Also, I am glad to hear that you can host the swf on a different website then where the server is hosted as this is what I am planing on doing.   ;Quote:Original post by redseadragonAnother question is if it is easy to switch to UDP when it comes out if TCP can't handle the load I put on it. If you networking is abstracted the switch could be easy. Making the switch a reliable UDP system would probably be the easiest at first then separate out reliable and non-reliable data.