Ah gotcha, though you said the program only crashed when you stopped the proxy, meaning it runs fine until then.
Anyways ive been looking at the thread that PKTINOS posted as well as searching the forums for more answers. I really cant give you a reason why, but sounds like what they are saying is that flash is sending a "<policy-file-request/>" and the proxy has to reply with the correct cross-domain-policy xml. Im not sure why this isnt something built into k-relay already. I also dont really understand why it is doing this for some people but not everyone.
Have you tried to connect to a normal server first, and then try to connect to the proxy server? Wondering if that might work or not.
Looking at the post PKTINOS linked, nilly talks about using source from this post (i think):
http://www.mpgh.net/forum/599-realm-...roxy-base.html
I took a look at the source of that proxy and it contain this, which is the kind of reply the client is looking for from the proxy:
Code:
public static final String POLICY_XML = "<?xml version=\"1.0\"?>" + "<cross-domain-policy>" + "<allow-access-from domain=\"*\" to-ports=\"*\" />" + "</cross-domain-policy>\n\u0000";
But i couldnt find any reference to "policy-file-request" or "cross-domain-policy" anywhere in k-relay's source. It sounds like it will need to be edited to check if the packet is "<policy-file-request/>", and if so reply with the correct cross-domain-policy xml. Or there has to be some workaround to avoid needing to send this, since not everyone is having this issue. Ill see if i can find anything else related to this though and let you know.
-- edit --
Ive done a little more reading. So its was mentioned in the post PKTINOS linked, there needs to be a separate connection listener on port 843. Basically this listener needs to check if the data sent to it is "<policy-file-request/>" (easiest to just check if the data contains the word policy), then respond with the correct cross-domain-policy xml. For example:
Code:
<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\"/></cross-domain-policy>\0
This is the answer to the problem, now someone needs to get k-relay programmed to do this. Im not very C# savvy but ill take a look and see if i can get something like that set up. If anyone else wants to do this it would be great as it is the answer to the problem people have been posting.
-- edit --
Heres my attempt at coding what i was talking about above. First, open "Proxy.cs" in lib_k_relay. Next, create a new TcpListener below "_localListener". I named it "_policyListener". Then, in the Start() function, below the _localListener code add:
Code:
_policyListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 843);
_policyListener.Start();
_policyListener.BeginAcceptTcpClient(PolicyConnect, null);
That should create the listener on the port that is supposedly the one that is used to send/receive the policy info. Now, go below the function LocalConnect() and make a new function called PolicyConnect(). I started by copying the LocalConnect() function and modifying it as needed. Here is what i came up with:
Code:
private void PolicyConnect(IAsyncResult ar)
{
PluginUtils.ProtectedInvoke(() =>
{
TcpClient policyClient = _policyListener.EndAcceptTcpClient(ar);
PluginUtils.Log("PolicyListener", "PolicyClient connected.");
NetworkStream stream = policyClient.GetStream();
StreamReader read = new StreamReader(stream, Encoding.UTF8);
StreamWriter write = new StreamWriter(stream, Encoding.UTF8);
string msg = "";
char[] data = new char[256];
int bytes = read.ReadBlock(data, 0, data.Length);
msg = new string(data);
PluginUtils.Log("PolicyListener", "Received: " + msg);
if (msg.Contains("policy"))
{
write.Write("<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>\0");
write.Flush();
}
read.Close();
write.Close();
stream.Close();
policyClient.Close();
}, "PolicyConnect", typeof(ObjectDisposedException));
PluginUtils.ProtectedInvoke(() =>
{
if (_policyListener != null) _policyListener.BeginAcceptTcpClient(PolicyConnect, null);
}, "PolicyListenerBeginListen");
}
Then try to compile and run it. I made these changes and ran it and it didnt cause the program to not work, so thats good. I cant say if this will work for you or not since i never had the issue you are having. But this should be close to the right solution. Hopefully if this doesnt work then someone with better C# knowledge can jump in and fix it so it does work for you. If this does work for you then let me know so i can get my code updated and posted so everyone else with this problem can use it.
Hope this works, or at least is on the right track.