I have a small chat app using an xmlsocket that connects to a Java server.
With the new update I know about handling the policy file request but I get the strangest thing happenning here.
If I immediately send out the policy file right when the new socket is created (on the Java server obviously) everything seems to work fine.
If I do a readLine from the incoming stream then send the policy file, flash seems to ‘freeze’…by that I mean nothing happens…no socket is connected.
It does attempt a connect twice since I have nothing listening on port 843.
Here’s a bit of code for the Java server:
clSocket = serverSocket.accept();
cs = new ClientSocket(clSocket);
new ClientSocketThread(cs);
....
....
cs.incoming = new BufferedReader(new InputStreamReader(cs.connection.getInputStream()));
cs.outgoing = new PrintStream(cs.connection.getOutputStream(),true);
String policy_response = "<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"6000\" secure=\"false\" /></cross-domain-policy>"+ "\0";
String mes = "";
if(cs.incoming.ready())
{
mes = cs.readln();
}
cs.outgoing.println(policy_response);
Again…if I have it this way it won’t work…flash just seems to sit there.
If I place the ‘send’ with the policy response before any readLine then it will work but I it’s problematic since I have to assume it’s making a policy file request. I would rather do a check on the readLine and make sure.
Anyone know what could be wrong here? Why can’t I read from the socket first?
Thanks in advance.