Hi, I’m trying to send a data structure such as
struct packet
{
int a;
int b;
int c;
};
(where a = 99, b = 2, c = 3 for example)
from a Visual C++ MFC Application (using CSocket) to a Flash movie using the following code:
First, I declared a class as follows:
class Packet {
var a:Number;
var b:Number;
var c:Number;
// Constructor function
function Packet (a:Number, b:Number, c:Number) {
this.a = a;
this.b = b;
this.c = c;
}
}
I am able to connect to the VC++ Server succesfully and receive data using the following code:
XMLSocket.prototype.onData = function(msg: Packet)
{
trace(msg);
}
However, instead of receiving the packet i send from the server, Flash MX receives the character “c” followed by 2 lines of whitespace.
Can anyone help? I don’t understand what i’m doing wrong here. Or are there alternate methods for server-client communication??