Hello guys.
Today I decieded to make my own private emu. I wanted to make 2in1 - making DO Emu + learning Node.JS (yes, I want to make that emu in Node.JS). Hope that at least one person knows wat is dat :P
So where's the problem ? Well.. I dont know. I am stuck at policy sending - It works, made especially TCP client with Node.JS for that (to check if that really works). Packet is sended properly, but the DO-Client (I am using old 2008 version) doesn't react at all...
I really dont have any idea where's the problem.
Here is my source:
Code:
var net = require('net');
var HOST = '127.0.0.1';
var PORT = 8080;
var POLICY = "<?xml version=\"1.0\"?><cross-domain-policy xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd\"><allow-access-from domain=\"*\" to-ports=\"*\" secure=\"false\" /><site-control permitted-cross-domain-policies=\"master-only\" /></cross-domain-policy>";
net.createServer(function(sock) {
console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);
sock.on('data', function(data) {
console.log('DATA ' + sock.remoteAddress + ': ' + data);
var packet = data.toString();
if (packet.indexOf("<policy-file-request/>") > -1) {
sock.write(POLICY);
console.log(POLICY);
console.log('Sended policy to: ' + sock.remoteAddress);
}
else
{
var split = packet.split('|');
console.log('PACKET: ' + packet[0]);
if (split[0] === 'LOGIN')
{
console.log('Client wants to login');
}
}
});
sock.on('close', function(data) {
console.log('CLOSED: ' + sock.remoteAddress +' '+ sock.remotePort);
});
}).listen(PORT, HOST);
console.log('Server listening on ' + HOST +':'+ PORT);
Code:
console.log(POLICY);
shows proper packet (
Code:
<?xml version="1.0"?><cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd"><allow-access-from domain="*" to-ports="*" secure="false" /><site-control permitted-cross-domain-policies="master-only" /></cross-domain-policy>
) without all \.
I dont know how to solve that. Anybody expirianced that kind of stuff?
Regards,
Nommo.
EDIT: Nevermind ... Problem was with flash stuff -> in Node.JS you need to end EVERY packet (client -> server & server -> client with \0 ). Hope that this will save someones time.