Java Server for Actionscript 3.0--Starting Help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Java Server for Actionscript 3.0--Starting Help

TuxBobbleTuxBobble Posts: 6Member
I'm working on a game in Flash/AS3. The idea is to have a multiplayer game running using Flash clients, and a Java server for synchronization.

As of right now I'm a LONG way away from accomplishing that goal. I've used Java before, but not in a while so I'm rusty. And at that, I hadn't ever really done stuff before, but I'm trying to brush up and learn a few things in the process.

So, I found this Java server/client pair from

I tried trimming the server down (I don't want any Knock Knock jokes right now lol) to communicate with AS3 using AS3's XMLSockets class. As of right now, I'm trying to figure out which side is causing the problem, so I had to choose between Java and AS forums for this post. I'm trying here first since I'm a bit more familiar with AS3 so I want to check that I'm doing things right on the Java side first.

//auto-flushing PrintWriter on client's outputstream
PrintWriter out = new PrintWriter(clntsocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(clntsocket.getInputStream()));
String inputLine;
inputLine = in.readLine();
if(inputLine != null){
out.println("Received OK!");
catch(Exception e){

I want to verify that I'm doing things right. The PrintWriter auto-flushes the stream, as far as I can tell. BufferedReader works fine, and the console print of inputLine works, so it's not missing the conditional statement or anything like that. But I can't seem to figure out how to transmit (or perhaps simply receive) the PrintWriter's flushed println. If anyone has any tips about what I'm doing here please let me know. The whole try-catch section is in a while() to keep it looping--not sure if that affects anything the way transmits.

UPDATE: I found the issue. Apparently on the Java side you need to terminate with a at the end of the transmission. That seems to allow for recognition of the transmission.

Any tips on XML format manipulation on the server side? Or should I just pass the "meat" of the XML, and receive it back into the same location to upadte the XML?
Sign In or Register to comment.