问题
I have an app that is trying to open a secure socket connection on a web server. I hosted a small code that servers the policy file on port 843 as is required by flash player in order to make the socket connection. But i am not receiving the specified string <policy-file-request/>
, in place of it i am getting the first string that is sent to port 443 during secure socket connection.
This flash socket policy server is taking more time than actual development process. Please shed some light.
回答1:
Before calling connect
on a Socket
-object, I make this call:
Security.loadPolicyFile("xmlsocket://" + ip + ":" + port);
As I mentioned in my comment it doesn't seem to reply anything, or even send the , if I run the SWF in a FlashPlayer. But I am able to connect via socket anyway. This is not the case if I run it on a webserver however. Then it will correctly trigger a response from the SocketServer that handles PolicyRequests.
回答2:
it looks like in order to serve a policy file to secure socket you have to open secure socket on server side, a normal tcp socket wont help. Although i still have no idea why do we have to serve the policy file over SSL, it's just a way to check if the connection is allowed. anyway if you are stuck go ahead and implement a secure socket on server side.
来源:https://stackoverflow.com/questions/9191565/not-receiving-policy-file-request-string-when-opening-a-secure-socket-from-fl